update boost on linux

This commit is contained in:
Bassem Girgis
2019-08-10 16:06:25 -05:00
parent 76ad52be58
commit 861b918727
5363 changed files with 483306 additions and 116507 deletions

View File

@@ -485,7 +485,7 @@ std::string cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::s
if(exponent() <= cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::max_exponent)
{
// How far to left-shift in order to demormalise the mantissa:
boost::intmax_t shift = (int)cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::bit_count - exponent() - 1;
boost::intmax_t shift = (boost::intmax_t)cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::bit_count - (boost::intmax_t)exponent() - 1;
boost::intmax_t digits_wanted = static_cast<int>(dig);
boost::intmax_t base10_exp = exponent() >= 0 ? static_cast<boost::intmax_t>(std::floor(0.30103 * exponent())) : static_cast<boost::intmax_t>(std::ceil(0.30103 * exponent()));
//
@@ -571,7 +571,7 @@ std::string cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::s
#else
max_bits *= 2;
#endif
shift = (int)cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::bit_count - exponent() - 1 - power10;
shift = (boost::intmax_t)cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::bit_count - exponent() - 1 - power10;
continue;
}
}
@@ -599,7 +599,7 @@ std::string cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::s
#else
max_bits *= 2;
#endif
shift = (int)cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::bit_count - exponent() - 1 - power10;
shift = (boost::intmax_t)cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::bit_count - exponent() - 1 - power10;
continue;
}
if(shift)
@@ -612,7 +612,7 @@ std::string cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::s
#else
max_bits *= 2;
#endif
shift = (int)cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::bit_count - exponent() - 1 - power10;
shift = (boost::intmax_t)cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::bit_count - exponent() - 1 - power10;
continue;
}
i >>= shift;
@@ -646,7 +646,7 @@ std::string cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::s
if(fixed)
digits_wanted = digits_got; // strange but true.
power10 = digits_wanted - base10_exp - 1;
shift = (int)cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::bit_count - exponent() - 1 - power10;
shift = (boost::intmax_t)cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::bit_count - exponent() - 1 - power10;
if(fixed)
break;
roundup = 0;

View File

@@ -64,6 +64,7 @@ void eval_exp(cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>
using default_ops::eval_subtract;
using default_ops::eval_add;
using default_ops::eval_convert_to;
using default_ops::eval_increment;
int type = eval_fpclassify(arg);
bool isneg = eval_get_sign(arg) < 0;
@@ -104,24 +105,41 @@ void eval_exp(cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>
eval_multiply(t, n, default_ops::get_constant_ln2<cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE> >());
eval_subtract(t, arg);
t.negate();
if (t.compare(default_ops::get_constant_ln2<cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE> >()) > 0)
{
// There are some rare cases where the multiply rounds down leaving a remainder > ln2
// See https://github.com/boostorg/multiprecision/issues/120
eval_increment(n);
t = limb_type(0);
}
if(eval_get_sign(t) < 0)
{
// There are some very rare cases where arg/ln2 is an integer, and the subsequent multiply
// rounds up, in that situation t ends up negative at this point which breaks our invariants below:
t = limb_type(0);
}
BOOST_ASSERT(t.compare(default_ops::get_constant_ln2<cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE> >()) < 0);
Exponent k, nn;
eval_convert_to(&nn, n);
if (nn == (std::numeric_limits<Exponent>::max)())
{
// The result will necessarily oveflow:
res = std::numeric_limits<number<cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE> > >::infinity().backend();
return;
}
BOOST_ASSERT(t.compare(default_ops::get_constant_ln2<cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE> >()) < 0);
k = nn ? Exponent(1) << (msb(nn) / 2) : 0;
k = (std::min)(k, (Exponent)(cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::bit_count / 4));
eval_ldexp(t, t, -k);
eval_exp_taylor(res, t);
//
// Square 1 + res k times:
//
for(int s = 0; s < k; ++s)
for(Exponent s = 0; s < k; ++s)
{
t.swap(res);
eval_multiply(res, t, t);