| 3358 | |
| 3359 | template <unsigned Digits10, class ExponentType, class Allocator, class ArgType> |
| 3360 | inline 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 | |
| 3389 | template <unsigned Digits10, class ExponentType, class Allocator> |
| 3390 | inline void eval_frexp(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const cpp_dec_float<Digits10, ExponentType, Allocator>& x, ExponentType* e) |
no test coverage detected