diff options
author | Mike Pall <mike> | 2016-03-28 21:39:31 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2016-03-28 21:39:31 +0200 |
commit | c7305408d150e1ca51195e8f31e4e3e6bd6b7c33 (patch) | |
tree | eeb7d8b6d68a6098519cbccf7bf4a059d917c9eb | |
parent | 713e34054f6206cb9d453a0924ffd7a302166bdd (diff) | |
download | luajit-c7305408d150e1ca51195e8f31e4e3e6bd6b7c33.tar.gz luajit-c7305408d150e1ca51195e8f31e4e3e6bd6b7c33.tar.bz2 luajit-c7305408d150e1ca51195e8f31e4e3e6bd6b7c33.zip |
Fix formatting of some small denormals at low precision.
Contributed by Peter Cawley.
-rw-r--r-- | src/lj_strfmt_num.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/lj_strfmt_num.c b/src/lj_strfmt_num.c index ab84fda7..79bc7610 100644 --- a/src/lj_strfmt_num.c +++ b/src/lj_strfmt_num.c | |||
@@ -364,6 +364,7 @@ static char *lj_strfmt_wfnum(SBuf *sb, SFormat sf, lua_Number n, char *p) | |||
364 | /* Precision is sufficiently low that rescaling will probably work. */ | 364 | /* Precision is sufficiently low that rescaling will probably work. */ |
365 | if ((ndebias = rescale_e[e >> 6])) { | 365 | if ((ndebias = rescale_e[e >> 6])) { |
366 | t.n = n * rescale_n[e >> 6]; | 366 | t.n = n * rescale_n[e >> 6]; |
367 | if (LJ_UNLIKELY(!e)) t.n *= 1e10, ndebias -= 10; | ||
367 | t.u64 -= 2; /* Convert 2ulp below (later we convert 2ulp above). */ | 368 | t.u64 -= 2; /* Convert 2ulp below (later we convert 2ulp above). */ |
368 | nd[0] = 0x100000 | (t.u32.hi & 0xfffff); | 369 | nd[0] = 0x100000 | (t.u32.hi & 0xfffff); |
369 | e = ((t.u32.hi >> 20) & 0x7ff) - 1075 - (ND_MUL2K_MAX_SHIFT < 29); | 370 | e = ((t.u32.hi >> 20) & 0x7ff) - 1075 - (ND_MUL2K_MAX_SHIFT < 29); |