| 3433 | |
| 3434 | template <unsigned Digits10, class ExponentType, class Allocator> |
| 3435 | inline void eval_frexp(cpp_dec_float<Digits10, ExponentType, Allocator>& result, const cpp_dec_float<Digits10, ExponentType, Allocator>& x, ExponentType* e) |
| 3436 | { |
| 3437 | result = x; |
| 3438 | |
| 3439 | if (result.iszero() || (result.isinf)() || (result.isnan)()) |
| 3440 | { |
| 3441 | *e = 0; |
| 3442 | return; |
| 3443 | } |
| 3444 | |
| 3445 | if (result.isneg()) |
| 3446 | result.negate(); |
| 3447 | |
| 3448 | typename cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type t = result.order(); |
| 3449 | BOOST_MP_USING_ABS |
| 3450 | if (abs(t) < ((std::numeric_limits<typename cpp_dec_float<Digits10, ExponentType, Allocator>::exponent_type>::max)() / 1000)) |
| 3451 | { |
| 3452 | t *= 1000; |
| 3453 | t /= 301; |
| 3454 | } |
| 3455 | else |
| 3456 | { |
| 3457 | t /= 301; |
| 3458 | t *= 1000; |
| 3459 | } |
| 3460 | |
| 3461 | result *= cpp_dec_float<Digits10, ExponentType, Allocator>::pow2(-t); |
| 3462 | |