MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / eval_ldexp

Function eval_ldexp

extern/boost/boost/multiprecision/cpp_dec_float.hpp:3360–3387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3358
3359template <unsigned Digits10, class ExponentType, class Allocator, class ArgType>
3360inline void eval_ldexp(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const cpp_dec_float<Digits10, ExponentType, Allocator>& x, ArgType e)
3361{
3362 const long long the_exp = static_cast<long long>(e);
3363
3364 if ((the_exp > (std::numeric_limits<typename cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type>::max)()) || (the_exp < (std::numeric_limits<typename cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type>::min)()))
3365 BOOST_MP_THROW_EXCEPTION(std::runtime_error(std::string("Exponent value is out of range.")));
3366
3367 result = x;
3368
3369 if ((the_exp > static_cast<long long>(-std::numeric_limits<long long>::digits)) && (the_exp < static_cast<long long>(0)))
3370 result.div_unsigned_long_long(1ULL << static_cast<long long>(-the_exp));
3371 else if ((the_exp < static_cast<long long>(std::numeric_limits<long long>::digits)) && (the_exp > static_cast<long long>(0)))
3372 result.mul_unsigned_long_long(1ULL << the_exp);
3373 else if (the_exp != static_cast<long long>(0))
3374 {
3375 if ((the_exp < cpp_dec_float<Digits10, ExponentType, Allocator>::cpp_dec_float_min_exp / 2) && (x.order() > 0))
3376 {
3377 long long half_exp = e / 2;
3378 cpp_dec_float<Digits10, ExponentType, Allocator> t = cpp_dec_float<Digits10, ExponentType, Allocator>::pow2(half_exp);
3379 result *= t;
3380 if (2 * half_exp != e)
3381 t *= 2;
3382 result *= t;
3383 }
3384 else
3385 result *= cpp_dec_float<Digits10, ExponentType, Allocator>::pow2(e);
3386 }
3387}
3388
3389template <unsigned Digits10, class ExponentType, class Allocator>
3390inline void eval_frexp(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const cpp_dec_float<Digits10, ExponentType, Allocator>& x, ExponentType* e)

Callers 15

generic_interconvertFunction · 0.85
eval_scalbnFunction · 0.85
calc_eFunction · 0.85
calc_piFunction · 0.85
hyp0F0Function · 0.85
hyp1F0Function · 0.85
eval_expFunction · 0.85
pow.hppFile · 0.85
eval_logFunction · 0.85
eval_exp2Function · 0.85
small_sinh_seriesFunction · 0.85
sinhcoshFunction · 0.85

Calls 1

orderMethod · 0.45

Tested by

no test coverage detected