Ticket #7806: fix_typo.patch

File fix_typo.patch, 20.1 KB (added by oss.2012.team+F4@…, 10 years ago)

Patch for Boost.Multiprecision

  • boost/multiprecision/detail/generic_interconvert.hpp

     
    114114#endif
    115115   //
    116116   // 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 convertion when the radix is other
     117   // radixes but it would complicate things.... use a string conversion when the radix is other
    118118   // than 2:
    119119   //
    120120   if(std::numeric_limits<number<From> >::radix != 2)
  • boost/multiprecision/detail/functions/pow.hpp

     
    535535template<class T, class A>
    536536inline typename enable_if<is_floating_point<A>, void>::type eval_pow(T& result, const T& x, const A& a)
    537537{
    538    // Note this one is resticted to float arguments since pow.hpp already has a version for
     538   // Note this one is restricted to float arguments since pow.hpp already has a version for
    539539   // integer powers....
    540540   typedef typename boost::multiprecision::detail::canonical<A, T>::type canonical_type;
    541541   typedef typename mpl::if_<is_same<A, canonical_type>, T, canonical_type>::type cast_type;
  • boost/multiprecision/detail/default_ops.hpp

     
    862862inline void eval_convert_to(terminal<R>* result, const B& backend)
    863863{
    864864   //
    865    // We ran out of types to try for the convertion, try
     865   // We ran out of types to try for the conversion, try
    866866   // a lexical_cast and hope for the best:
    867867   //
    868868   result->value = boost::lexical_cast<R>(backend.str(0, std::ios_base::fmtflags(0)));
  • boost/multiprecision/random.hpp

     
    500500        // (range+1)/(brange+1) > limit+1                by (5)              (6)
    501501        // limit < floor((range+1)/(brange+1))           by (6)              (7)
    502502        // limit==floor((range+1)/(brange+1))            def. of limit       (8)
    503         // not (2)                                       reductio            (9)
     503        // not (2)                                       reduction           (9)
    504504        //
    505505        // loop postcondition: (range/mult)*mult+(mult-1) >= range
    506506        //
     
    523523                static_cast<range_type>(range/mult),
    524524                boost::mpl::true_());
    525525        if(std::numeric_limits<range_type>::is_bounded && ((std::numeric_limits<range_type>::max)() / mult < result_increment)) {
    526           // The multiplcation would overflow.  Reject immediately.
     526          // The multiplication would overflow.  Reject immediately.
    527527          continue;
    528528        }
    529529        result_increment *= mult;
  • boost/multiprecision/cpp_dec_float.hpp

     
    812812   bool overflow = exp >= cpp_dec_float_max_exp10;
    813813   if(exp == cpp_dec_float_max_exp10)
    814814   {
    815       // Check to see if we really truely have an overflow or not...
     815      // Check to see if we really truly have an overflow or not...
    816816      if(isneg())
    817817      {
    818818         cpp_dec_float t(*this);
  • boost/multiprecision/cpp_int/cpp_int_config.hpp

     
    1919
    2020//
    2121// These traits calculate the largest type in the list
    22 // [unsigned] ong long, long, int, which has the specified number
     22// [unsigned] long long, long, int, which has the specified number
    2323// of bits.  Note that intN_t and boost::int_t<N> find the first
    2424// member of the above list, not the last.  We want the last in the
    2525// list to ensure that mixed arithmetic operations are as efficient
     
    6161   >::type type;
    6262};
    6363
    64 } // namepsace detail
     64} // namespace detail
    6565
    6666#if defined(BOOST_HAS_INT128)
    6767
  • boost/multiprecision/cpp_int/bitwise.hpp

     
    351351}
    352352
    353353//
    354 // Over agin for trivial cpp_int's:
     354// Over again for trivial cpp_int's:
    355355//
    356356template <unsigned MinBits1, unsigned MaxBits1, cpp_integer_type SignType1, cpp_int_check_type Checked1, class Allocator1, class T>
    357357BOOST_MP_FORCEINLINE typename enable_if<is_trivial_cpp_int<cpp_int_backend<MinBits1, MaxBits1, SignType1, Checked1, Allocator1> > >::type
  • boost/multiprecision/cpp_int/checked.hpp

     
    1010
    1111//
    1212// 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.
    1414//
    1515
    1616inline void raise_overflow(std::string op)
  • boost/multiprecision/cpp_int/add.hpp

     
    7979template <class CppInt1, class CppInt2>
    8080inline void add_unsigned(CppInt1& result, const CppInt2& a, const limb_type& o) BOOST_NOEXCEPT_IF(is_non_throwing_cpp_int<CppInt1>::value)
    8181{
    82    // Addition using modular arithmatic.
     82   // Addition using modular arithmetic.
    8383   // Nothing fancy, just let uintmax_t take the strain:
    8484   if(&result != &a)
    8585      result.resize(a.size(), a.size());
  • boost/multiprecision/number.hpp

     
    355355   // even if the result of the operator *is never used*.
    356356   // Possibly we could modify our expression wrapper to
    357357   // execute the increment/decrement on destruction, but
    358    // correct implemetation will be tricky, so defered for now...
     358   // correct implementation will be tricky, so deferred for now...
    359359   //
    360360   BOOST_MP_FORCEINLINE number& operator++()
    361361   {
     
    16871687   a.swap(b);
    16881688}
    16891689
    1690 }  // namespace multipreciion
     1690}  // namespace multiprecision
    16911691
    16921692template <class T>
    16931693class rational;
  • libs/multiprecision/test/test_cpp_int.cpp

     
    325325      if(!std::numeric_limits<test_type>::is_modulo)
    326326      {
    327327         // 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 diffferent result from arbitrary
     328         // also don't test for modulo types, as these may give a different result from arbitrary
    329329         // precision types:
    330330         BOOST_CHECK_EQUAL(mpz_int(pow(d, ui % 19)).str(), test_type(pow(d1, ui % 19)).str());
    331331         BOOST_CHECK_EQUAL(mpz_int(powm(a, b, c)).str(), test_type(powm(a1, b1, c1)).str());
  • libs/multiprecision/doc/multiprecision.qbk

     
    510510* 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:
    511511the extra word stores both the sign, and how many machine words in the integer are actually in use. 
    512512The latter is an optimisation for larger fixed precision integers, so that a 1024-bit integer has almost the same performance
    513 characterists as a 128-bit integer, rather than being 4 times slower for addition and 16 times slower for multiplication
     513characteristics as a 128-bit integer, rather than being 4 times slower for addition and 16 times slower for multiplication
    514514 (assuming the values involved would always fit in 128 bits).
    515515Typically this means you can use
    516516an integer type wide enough for the "worst case senario" with only minor performance degradation even if most of the time
     
    655655The typedefs `cpp_dec_float_50` and `cpp_dec_float_100` provide arithmetic types at 50 and 100 decimal digits precision
    656656respectively.  Optionally, you can specify an integer type to use for the exponent, this defaults to a 32-bit integer type
    657657which 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 truely huge exponent range.  In any case the ExponentType must be a built in signed integer type at least 2 bytes
     658if you need a truly huge exponent range.  In any case the ExponentType must be a built in signed integer type at least 2 bytes
    659659and 16-bits wide.
    660660
    661661Normally `cpp_dec_float` allocates no memory: all of the space required for its digits are allocated
     
    797797or stack allocation (where all the memory required for the underlying data types is stored
    798798within `mpfr_float_backend`).  The latter option can result in significantly faster code, at the
    799799expense 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 guarentee that using `allocate_stack`
     800should only be used for lower digit counts.  Note that we can not guarantee that using `allocate_stack`
    801801won't cause any calls to mpfr's allocation routines, as mpfr may call these inside it's own code.
    802802The following table gives an idea of the performance tradeoff's at 50 decimal digits
    803803precision[footnote Compiled with VC++10 and /Ox, with MPFR-3.0.0 and MPIR-2.3.0]:
     
    11351135
    11361136   int128_t     i128 = 0;
    11371137   int266_t     i256 = i128;  // OK implicit widening conversion
    1138    i128_t            = i256;  // Error, no assignment operator found, narrowing conversion is explict
     1138   i128_t            = i256;  // Error, no assignment operator found, narrowing conversion is explicit
    11391139   i128_t            = static_cast<int128_t>(i256); // OK, explicit narrowing conversion
    11401140
    11411141   mpz_int      z    = 0;
     
    11661166   mpf_float i(m);        // copies the value of the native type.
    11671167
    11681168More information on what additional types a backend supports conversions from are given in the tutorial for each backend.
    1169 The converting constructor will be implict if the backend's converting constructor is also implicit, and explicit if the
     1169The converting constructor will be implicit if the backend's converting constructor is also implicit, and explicit if the
    11701170backends converting constructor is also explicit.
    11711171
    11721172[endsect]
     
    18391839Also note that with the exception of `abs` that these functions can only be used with floating-point Backend types (if any other types
    18401840such as fixed precision or complex types are added to the library later, then these functions may be extended to support those number types).
    18411841
    1842 The precision of these functions is generally deterimined by the backend implementation.  For example the precision
     1842The precision of these functions is generally determined by the backend implementation.  For example the precision
    18431843of 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 transcendal functions is generally a few epsilon.  Note however, that the trigonmetrical
     1844implementations, the accuracy of the transcendental functions is generally a few epsilon.  Note however, that the trigonometrical
    18451845functions incur the usual accuracy loss when reducing arguments by large multiples of [pi].  Also note that both __mpf_float
    18461846and __cpp_dec_float have a number of guard digits beyond their stated precision, so the error rates listed for these
    18471847are in some sense artificially low.
     
    23112311[[`b = b`][`B&`][Assignment operator.][[space]]]
    23122312[[`b = a`][`B&`][Assignment from an Arithmetic type.  The type of `a` shall be listed in one of the type lists
    23132313            `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 interpretted 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.]]
    23152315[[`b.swap(b)`][`void`][Swaps the contents of its arguments.][`noexcept`]]
    23162316[[`cb.str(ui, bb)`][`std::string`][Returns the string representation of `b` with `ui` digits and in scientific format if `bb` is `true`.
    23172317                  If `ui` is zero, then returns as many digits as are required to reconstruct the original value.][[space]]]
     
    24722472            When not provided does the equivalent of `eval_multiply(b, cb, cb2)` followed by
    24732473            `eval_add(b, cb3)`.
    24742474            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 type listed in one of the type lists
     2475            `cb`, `cb2` and `cb3` with any type listed in one of the type lists
    24762476            `B::signed_types`, `B::unsigned_types` or `B::float_types`.][[space]]]
    24772477[[`eval_multiply_subtract(b, cb, cb2, cb3)`][`void`][Multiplies `cb` by `cb2` and subtracts from the result `cb3` storing the result in `b`.
    24782478            When not provided does the equivalent of `eval_multiply(b, cb, cb2)` followed by
    24792479            `eval_subtract(b, cb3)`.
    24802480            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 type listed in one of the type lists
     2481            `cb`, `cb2` and `cb3` with any type listed in one of the type lists
    24822482            `B::signed_types`, `B::unsigned_types` or `B::float_types`.][[space]]]
    24832483[[`eval_divide(b, a)`][`void`][Divides `b` by `a`.  The type of `a` shall be listed in one of the type lists
    24842484            `B::signed_types`, `B::unsigned_types` or `B::float_types`.
     
    26772677[[rational_adapter.hpp][Defines the `rational_adapter` backend.]]
    26782678[[cpp_dec_float.hpp][Defines the `cpp_dec_float` backend.]]
    26792679[[tommath.hpp][Defines the `tommath_int` backend.]]
    2680 [[concepts/number_archetypes.hpp][Defines a backend concept architypes for testing use.]]
     2680[[concepts/number_archetypes.hpp][Defines a backend concept archetypes for testing use.]]
    26812681]
    26822682
    26832683[table Implementation Headers]
     
    33793379* Add a back-end for MPFR interval arithmetic.
    33803380* Add better multiplication routines (Karatsuba, FFT etc) to cpp_int_backend.
    33813381* Add assembly level routines to cpp_int_backend.
    3382 * Add an all C++ Boost licenced binary floating point type.
     3382* Add an all C++ Boost licensed binary floating point type.
    33833383* 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 convertion.
     3384the hard part is IO and binary-decimal conversion.
    33853385* Should there be a choice of rounding mode (probably MPFR specific)?
    33863386* We can reuse temporaries in multiple subtrees (temporary caching).
    33873387* cpp_dec_float should round to nearest.
     
    34053405* Each back-end should document the requirements it satisfies (not currently scheduled for inclusion: it's
    34063406deliberately an implementation detail, and "optional" requirements are optimisations which can't be detected
    34073407by the user).  Not done: this is an implementation detail, the exact list of requirements satisfied is purely
    3408 an optimimization, not something the user can detect.
     3408an optimization, not something the user can detect.
    34093409* A backend for an overflow aware integers (done 2012/10/31).
    34103410* IIUC convert_to is used to emulate in c++98 compilers C++11 explicit
    34113411conversions. Could the explicit conversion operator be added on
     
    34213421* The library interface should use the noexcept (BOOST_NOEXCEPT, ...)
    34223422facilities (Done 2012/09/15).
    34233423* It is unfortunate that the generic mp_number front end can not make use
    3424 contexpr as not all the backends can ensure this (done - we can go quite a way).
     3424constexpr as not all the backends can ensure this (done - we can go quite a way).
    34253425* literals: The library doesn't provide some kind of literals. I think that the
    34263426mp_number class should provide a way to create literals if the backend
    34273427is able to.  (Done 2012/09/15).
     
    34363436template argument that defaults to 0 (meaning keep going till no more space/memory).  Done.
    34373437* Can ring types (exact floating point types) be supported?  The answer should be yes, but someone needs to write it (Moved to TODO list).
    34383438* 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 templare 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.
    34403440Open question - what should be the default - int32_t or int64_t?  (done 2012/09/06)
    34413441* Document the size requirements of fixed precision ints (done 2012/09/15).
    34423442* Document std lib function accuracy (done 2012/09/15).
     
    34883488   proto has to offer anyway, a lightweight expression template mechanism was used instead.
    34893489   Compile times are still too slow...]]
    34903490[[Why not abstract out addition/multiplication algorithms?]
    3491    [This was deamed not to be practical: these algorithms are intimately
     3491   [This was deemed not to be practical: these algorithms are intimately
    34923492   tied to the actual data representation used.]]
    34933493]
    34943494
  • libs/multiprecision/doc/html4_symbols.qbk

     
    1010[/ http://www.htmlhelp.com/reference/html40/entities/latin1.html]
    1111[/Unicode Latin extended http://www.unicode.org/charts/U0080.pdf]
    1212
    13 [/ Also some miscellaneous math charaters added to this list - see the end.]
     13[/ Also some miscellaneous math characters added to this list - see the end.]
    1414[/ For others see also math_symbols.qbk]
    1515
    1616[/ To use, enclose the template name in square brackets.]
  • libs/multiprecision/example/floating_point_examples.cpp

     
    163163
    164164   JEL(cpp_dec_float_50(v + 0.5), z);
    165165
    166 However, if we want the function JEL to be truely reusable, then a better solution might be preferred.
     166However, if we want the function JEL to be truly reusable, then a better solution might be preferred.
    167167To achieve this we can borrow some code from Boost.Math which calculates the return type of mixed-argument
    168168functions, here's how the new code looks now:
    169169
     
    543543   // to handle expression templates etc.  As a result it's hard to take its
    544544   // address without knowing about its implementation details.  We'll use a
    545545   // C++11 lambda expression to capture the call.
    546    // We also need a typecast on the first argument so we don't accidently pass
     546   // We also need a typecast on the first argument so we don't accidentally pass
    547547   // an expression template to a template function:
    548548   //
    549549   const cpp_dec_float_50 d_mp = derivative(