diff options
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -3452,8 +3452,12 @@ ruby_dtoa(double d_, int mode, int ndigits, int *decpt, int *sign, char **rve) ilim = i; *s++ = '0' + (int)L; if (i == ilim) { + double x; if (dval(d) > 0.5 + dval(eps)) goto bump_up; + else if (!isinf(x = d_ * tens[ilim-1] + 0.5) && + dval(d) > modf(x, &x)) + goto bump_up; else if (dval(d) < 0.5 - dval(eps)) { while (*--s == '0') ; s++; |