diff options
Diffstat (limited to 'src/get_d64.c')
-rw-r--r-- | src/get_d64.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/get_d64.c b/src/get_d64.c index 03dbfd916..d5fd4d64c 100644 --- a/src/get_d64.c +++ b/src/get_d64.c @@ -347,6 +347,15 @@ mpfr_get_decimal64 (mpfr_srcptr src, mpfr_rnd_t rnd_mode) which corresponds to s=[0.]1000...000 and e=-397 */ if (e < -397) { + if (rnd_mode == MPFR_RNDN && e == -398) + { + /* If 0.5E-398 < |src| < 1E-398 (smallest subnormal), + src should round to +/- 1E-398 in MPFR_RNDN. */ + mpfr_get_str (s, &e, 10, 1, src, MPFR_RNDA); + return e == -398 && s[negative] <= '5' ? + get_decimal64_zero (negative) : + get_decimal64_min (negative); + } if (rnd_mode == MPFR_RNDZ || rnd_mode == MPFR_RNDN || (rnd_mode == MPFR_RNDD && negative == 0) || (rnd_mode == MPFR_RNDU && negative != 0)) |