Ticket #7806: fix_typo.patch
File fix_typo.patch, 20.1 KB (added by , 10 years ago) |
---|
-
boost/multiprecision/detail/generic_interconvert.hpp
114 114 #endif 115 115 // 116 116 // The code here only works when the radix of "From" is 2, we could try shifting by other 117 // radixes but it would complicate things.... use a string conver tion when the radix is other117 // radixes but it would complicate things.... use a string conversion when the radix is other 118 118 // than 2: 119 119 // 120 120 if(std::numeric_limits<number<From> >::radix != 2) -
boost/multiprecision/detail/functions/pow.hpp
535 535 template<class T, class A> 536 536 inline typename enable_if<is_floating_point<A>, void>::type eval_pow(T& result, const T& x, const A& a) 537 537 { 538 // Note this one is rest icted to float arguments since pow.hpp already has a version for538 // Note this one is restricted to float arguments since pow.hpp already has a version for 539 539 // integer powers.... 540 540 typedef typename boost::multiprecision::detail::canonical<A, T>::type canonical_type; 541 541 typedef typename mpl::if_<is_same<A, canonical_type>, T, canonical_type>::type cast_type; -
boost/multiprecision/detail/default_ops.hpp
862 862 inline void eval_convert_to(terminal<R>* result, const B& backend) 863 863 { 864 864 // 865 // We ran out of types to try for the conver tion, try865 // We ran out of types to try for the conversion, try 866 866 // a lexical_cast and hope for the best: 867 867 // 868 868 result->value = boost::lexical_cast<R>(backend.str(0, std::ios_base::fmtflags(0))); -
boost/multiprecision/random.hpp
500 500 // (range+1)/(brange+1) > limit+1 by (5) (6) 501 501 // limit < floor((range+1)/(brange+1)) by (6) (7) 502 502 // limit==floor((range+1)/(brange+1)) def. of limit (8) 503 // not (2) reductio 503 // not (2) reduction (9) 504 504 // 505 505 // loop postcondition: (range/mult)*mult+(mult-1) >= range 506 506 // … … 523 523 static_cast<range_type>(range/mult), 524 524 boost::mpl::true_()); 525 525 if(std::numeric_limits<range_type>::is_bounded && ((std::numeric_limits<range_type>::max)() / mult < result_increment)) { 526 // The multipl cation would overflow. Reject immediately.526 // The multiplication would overflow. Reject immediately. 527 527 continue; 528 528 } 529 529 result_increment *= mult; -
boost/multiprecision/cpp_dec_float.hpp
812 812 bool overflow = exp >= cpp_dec_float_max_exp10; 813 813 if(exp == cpp_dec_float_max_exp10) 814 814 { 815 // Check to see if we really tru ely have an overflow or not...815 // Check to see if we really truly have an overflow or not... 816 816 if(isneg()) 817 817 { 818 818 cpp_dec_float t(*this); -
boost/multiprecision/cpp_int/cpp_int_config.hpp
19 19 20 20 // 21 21 // These traits calculate the largest type in the list 22 // [unsigned] ong long, long, int, which has the specified number22 // [unsigned] long long, long, int, which has the specified number 23 23 // of bits. Note that intN_t and boost::int_t<N> find the first 24 24 // member of the above list, not the last. We want the last in the 25 25 // list to ensure that mixed arithmetic operations are as efficient … … 61 61 >::type type; 62 62 }; 63 63 64 } // name psace detail64 } // namespace detail 65 65 66 66 #if defined(BOOST_HAS_INT128) 67 67 -
boost/multiprecision/cpp_int/bitwise.hpp
351 351 } 352 352 353 353 // 354 // Over ag in for trivial cpp_int's:354 // Over again for trivial cpp_int's: 355 355 // 356 356 template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, class T> 357 357 BOOST_MP_FORCEINLINE typename enable_if<is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> > >::type -
boost/multiprecision/cpp_int/checked.hpp
10 10 11 11 // 12 12 // Simple routines for performing checked arithmetic with a builtin arithmetic type. 13 // Note that is is not a complete header, it must be included as part of boost/multiprecision/cpp_int.hpp.13 // Note that this is not a complete header, it must be included as part of boost/multiprecision/cpp_int.hpp. 14 14 // 15 15 16 16 inline void raise_overflow(std::string op) -
boost/multiprecision/cpp_int/add.hpp
79 79 template <class CppInt1, class CppInt2> 80 80 inline void add_unsigned(CppInt1& result, const CppInt2& a, const limb_type& o) BOOST_NOEXCEPT_IF(is_non_throwing_cpp_int<CppInt1>::value) 81 81 { 82 // Addition using modular arithm atic.82 // Addition using modular arithmetic. 83 83 // Nothing fancy, just let uintmax_t take the strain: 84 84 if(&result != &a) 85 85 result.resize(a.size(), a.size()); -
boost/multiprecision/number.hpp
355 355 // even if the result of the operator *is never used*. 356 356 // Possibly we could modify our expression wrapper to 357 357 // execute the increment/decrement on destruction, but 358 // correct impleme tation will be tricky, so defered for now...358 // correct implementation will be tricky, so deferred for now... 359 359 // 360 360 BOOST_MP_FORCEINLINE number& operator++() 361 361 { … … 1687 1687 a.swap(b); 1688 1688 } 1689 1689 1690 } // namespace multipreci ion1690 } // namespace multiprecision 1691 1691 1692 1692 template <class T> 1693 1693 class rational; -
libs/multiprecision/test/test_cpp_int.cpp
325 325 if(!std::numeric_limits<test_type>::is_modulo) 326 326 { 327 327 // We have to take care that our powers don't grow too large, otherwise this takes "forever", 328 // also don't test for modulo types, as these may give a diff ferent result from arbitrary328 // also don't test for modulo types, as these may give a different result from arbitrary 329 329 // precision types: 330 330 BOOST_CHECK_EQUAL(mpz_int(pow(d, ui % 19)).str(), test_type(pow(d1, ui % 19)).str()); 331 331 BOOST_CHECK_EQUAL(mpz_int(powm(a, b, c)).str(), test_type(powm(a1, b1, c1)).str()); -
libs/multiprecision/doc/multiprecision.qbk
510 510 * When used at fixed precision, the size of this type is always one machine word larger than you would expect for an N-bit integer: 511 511 the extra word stores both the sign, and how many machine words in the integer are actually in use. 512 512 The latter is an optimisation for larger fixed precision integers, so that a 1024-bit integer has almost the same performance 513 characterist s as a 128-bit integer, rather than being 4 times slower for addition and 16 times slower for multiplication513 characteristics as a 128-bit integer, rather than being 4 times slower for addition and 16 times slower for multiplication 514 514 (assuming the values involved would always fit in 128 bits). 515 515 Typically this means you can use 516 516 an integer type wide enough for the "worst case senario" with only minor performance degradation even if most of the time … … 655 655 The typedefs `cpp_dec_float_50` and `cpp_dec_float_100` provide arithmetic types at 50 and 100 decimal digits precision 656 656 respectively. Optionally, you can specify an integer type to use for the exponent, this defaults to a 32-bit integer type 657 657 which is more than large enough for the vast majority of use cases, but larger types such as `long long` can also be specified 658 if you need a tru ely huge exponent range. In any case the ExponentType must be a built in signed integer type at least 2 bytes658 if you need a truly huge exponent range. In any case the ExponentType must be a built in signed integer type at least 2 bytes 659 659 and 16-bits wide. 660 660 661 661 Normally `cpp_dec_float` allocates no memory: all of the space required for its digits are allocated … … 797 797 or stack allocation (where all the memory required for the underlying data types is stored 798 798 within `mpfr_float_backend`). The latter option can result in significantly faster code, at the 799 799 expense of growing the size of `mpfr_float_backend`. It can only be used at fixed precision, and 800 should only be used for lower digit counts. Note that we can not guar entee that using `allocate_stack`800 should only be used for lower digit counts. Note that we can not guarantee that using `allocate_stack` 801 801 won't cause any calls to mpfr's allocation routines, as mpfr may call these inside it's own code. 802 802 The following table gives an idea of the performance tradeoff's at 50 decimal digits 803 803 precision[footnote Compiled with VC++10 and /Ox, with MPFR-3.0.0 and MPIR-2.3.0]: … … 1135 1135 1136 1136 int128_t i128 = 0; 1137 1137 int266_t i256 = i128; // OK implicit widening conversion 1138 i128_t = i256; // Error, no assignment operator found, narrowing conversion is explic t1138 i128_t = i256; // Error, no assignment operator found, narrowing conversion is explicit 1139 1139 i128_t = static_cast<int128_t>(i256); // OK, explicit narrowing conversion 1140 1140 1141 1141 mpz_int z = 0; … … 1166 1166 mpf_float i(m); // copies the value of the native type. 1167 1167 1168 1168 More information on what additional types a backend supports conversions from are given in the tutorial for each backend. 1169 The converting constructor will be implic t if the backend's converting constructor is also implicit, and explicit if the1169 The converting constructor will be implicit if the backend's converting constructor is also implicit, and explicit if the 1170 1170 backends converting constructor is also explicit. 1171 1171 1172 1172 [endsect] … … 1839 1839 Also note that with the exception of `abs` that these functions can only be used with floating-point Backend types (if any other types 1840 1840 such as fixed precision or complex types are added to the library later, then these functions may be extended to support those number types). 1841 1841 1842 The precision of these functions is generally deter imined by the backend implementation. For example the precision1842 The precision of these functions is generally determined by the backend implementation. For example the precision 1843 1843 of these functions when used with __mpfr_float_backend is determined entirely by [mpfr]. When these functions use our own 1844 implementations, the accuracy of the transcend al functions is generally a few epsilon. Note however, that the trigonmetrical1844 implementations, the accuracy of the transcendental functions is generally a few epsilon. Note however, that the trigonometrical 1845 1845 functions incur the usual accuracy loss when reducing arguments by large multiples of [pi]. Also note that both __mpf_float 1846 1846 and __cpp_dec_float have a number of guard digits beyond their stated precision, so the error rates listed for these 1847 1847 are in some sense artificially low. … … 2311 2311 [[`b = b`][`B&`][Assignment operator.][[space]]] 2312 2312 [[`b = a`][`B&`][Assignment from an Arithmetic type. The type of `a` shall be listed in one of the type lists 2313 2313 `B::signed_types`, `B::unsigned_types` or `B::float_types`.][[space]]] 2314 [[`b = s`][`B&`][Assignment from a string.][Throws a `std::runtime_error` if the string could not be interpret ted as a valid number.]]2314 [[`b = s`][`B&`][Assignment from a string.][Throws a `std::runtime_error` if the string could not be interpreted as a valid number.]] 2315 2315 [[`b.swap(b)`][`void`][Swaps the contents of its arguments.][`noexcept`]] 2316 2316 [[`cb.str(ui, bb)`][`std::string`][Returns the string representation of `b` with `ui` digits and in scientific format if `bb` is `true`. 2317 2317 If `ui` is zero, then returns as many digits as are required to reconstruct the original value.][[space]]] … … 2472 2472 When not provided does the equivalent of `eval_multiply(b, cb, cb2)` followed by 2473 2473 `eval_add(b, cb3)`. 2474 2474 For brevity, only a version showing all arguments of type `B` is shown here, but you can replace up to any 2 of 2475 `cb`, `cb2` and `cb3` with any type typelisted in one of the type lists2475 `cb`, `cb2` and `cb3` with any type listed in one of the type lists 2476 2476 `B::signed_types`, `B::unsigned_types` or `B::float_types`.][[space]]] 2477 2477 [[`eval_multiply_subtract(b, cb, cb2, cb3)`][`void`][Multiplies `cb` by `cb2` and subtracts from the result `cb3` storing the result in `b`. 2478 2478 When not provided does the equivalent of `eval_multiply(b, cb, cb2)` followed by 2479 2479 `eval_subtract(b, cb3)`. 2480 2480 For brevity, only a version showing all arguments of type `B` is shown here, but you can replace up to any 2 of 2481 `cb`, `cb2` and `cb3` with any type typelisted in one of the type lists2481 `cb`, `cb2` and `cb3` with any type listed in one of the type lists 2482 2482 `B::signed_types`, `B::unsigned_types` or `B::float_types`.][[space]]] 2483 2483 [[`eval_divide(b, a)`][`void`][Divides `b` by `a`. The type of `a` shall be listed in one of the type lists 2484 2484 `B::signed_types`, `B::unsigned_types` or `B::float_types`. … … 2677 2677 [[rational_adapter.hpp][Defines the `rational_adapter` backend.]] 2678 2678 [[cpp_dec_float.hpp][Defines the `cpp_dec_float` backend.]] 2679 2679 [[tommath.hpp][Defines the `tommath_int` backend.]] 2680 [[concepts/number_archetypes.hpp][Defines a backend concept arch itypes for testing use.]]2680 [[concepts/number_archetypes.hpp][Defines a backend concept archetypes for testing use.]] 2681 2681 ] 2682 2682 2683 2683 [table Implementation Headers] … … 3379 3379 * Add a back-end for MPFR interval arithmetic. 3380 3380 * Add better multiplication routines (Karatsuba, FFT etc) to cpp_int_backend. 3381 3381 * Add assembly level routines to cpp_int_backend. 3382 * Add an all C++ Boost licen ced binary floating point type.3382 * Add an all C++ Boost licensed binary floating point type. 3383 3383 * Can ring types (exact floating point types) be supported? The answer should be yes, but someone needs to write it, 3384 the hard part is IO and binary-decimal conver tion.3384 the hard part is IO and binary-decimal conversion. 3385 3385 * Should there be a choice of rounding mode (probably MPFR specific)? 3386 3386 * We can reuse temporaries in multiple subtrees (temporary caching). 3387 3387 * cpp_dec_float should round to nearest. … … 3405 3405 * Each back-end should document the requirements it satisfies (not currently scheduled for inclusion: it's 3406 3406 deliberately an implementation detail, and "optional" requirements are optimisations which can't be detected 3407 3407 by the user). Not done: this is an implementation detail, the exact list of requirements satisfied is purely 3408 an optimi mization, not something the user can detect.3408 an optimization, not something the user can detect. 3409 3409 * A backend for an overflow aware integers (done 2012/10/31). 3410 3410 * IIUC convert_to is used to emulate in c++98 compilers C++11 explicit 3411 3411 conversions. Could the explicit conversion operator be added on … … 3421 3421 * The library interface should use the noexcept (BOOST_NOEXCEPT, ...) 3422 3422 facilities (Done 2012/09/15). 3423 3423 * It is unfortunate that the generic mp_number front end can not make use 3424 con texpr as not all the backends can ensure this (done - we can go quite a way).3424 constexpr as not all the backends can ensure this (done - we can go quite a way). 3425 3425 * literals: The library doesn't provide some kind of literals. I think that the 3426 3426 mp_number class should provide a way to create literals if the backend 3427 3427 is able to. (Done 2012/09/15). … … 3436 3436 template argument that defaults to 0 (meaning keep going till no more space/memory). Done. 3437 3437 * Can ring types (exact floating point types) be supported? The answer should be yes, but someone needs to write it (Moved to TODO list). 3438 3438 * Should there be a choice of rounding mode (probably MPFR specific)? Moved to TODO list. 3439 * Make the exponent type for cpp_dec_float a templa re parameter, maybe include support for big-integer exponents.3439 * Make the exponent type for cpp_dec_float a template parameter, maybe include support for big-integer exponents. 3440 3440 Open question - what should be the default - int32_t or int64_t? (done 2012/09/06) 3441 3441 * Document the size requirements of fixed precision ints (done 2012/09/15). 3442 3442 * Document std lib function accuracy (done 2012/09/15). … … 3488 3488 proto has to offer anyway, a lightweight expression template mechanism was used instead. 3489 3489 Compile times are still too slow...]] 3490 3490 [[Why not abstract out addition/multiplication algorithms?] 3491 [This was de amed not to be practical: these algorithms are intimately3491 [This was deemed not to be practical: these algorithms are intimately 3492 3492 tied to the actual data representation used.]] 3493 3493 ] 3494 3494 -
libs/multiprecision/doc/html4_symbols.qbk
10 10 [/ http://www.htmlhelp.com/reference/html40/entities/latin1.html] 11 11 [/Unicode Latin extended http://www.unicode.org/charts/U0080.pdf] 12 12 13 [/ Also some miscellaneous math chara ters added to this list - see the end.]13 [/ Also some miscellaneous math characters added to this list - see the end.] 14 14 [/ For others see also math_symbols.qbk] 15 15 16 16 [/ To use, enclose the template name in square brackets.] -
libs/multiprecision/example/floating_point_examples.cpp
163 163 164 164 JEL(cpp_dec_float_50(v + 0.5), z); 165 165 166 However, if we want the function JEL to be tru ely reusable, then a better solution might be preferred.166 However, if we want the function JEL to be truly reusable, then a better solution might be preferred. 167 167 To achieve this we can borrow some code from Boost.Math which calculates the return type of mixed-argument 168 168 functions, here's how the new code looks now: 169 169 … … 543 543 // to handle expression templates etc. As a result it's hard to take its 544 544 // address without knowing about its implementation details. We'll use a 545 545 // C++11 lambda expression to capture the call. 546 // We also need a typecast on the first argument so we don't accident ly pass546 // We also need a typecast on the first argument so we don't accidentally pass 547 547 // an expression template to a template function: 548 548 // 549 549 const cpp_dec_float_50 d_mp = derivative(