Commit 07ef6552 authored by Guido van Rossum's avatar Guido van Rossum

Oops -- unpack float/double didn't do the right thing if e==0.

parent 74679b45
...@@ -402,8 +402,13 @@ unpack_float(p, incr) ...@@ -402,8 +402,13 @@ unpack_float(p, incr)
x = (double)f / 8388608.0; x = (double)f / 8388608.0;
/* XXX This sadly ignores Inf/NaN issues */ /* XXX This sadly ignores Inf/NaN issues */
if (e != 0) if (e == 0)
x = ldexp(1.0 + x, e - 127); e = -126;
else {
x += 1.0;
e -= 127;
}
x = ldexp(x, e);
if (s) if (s)
x = -x; x = -x;
...@@ -459,8 +464,13 @@ unpack_double(p, incr) ...@@ -459,8 +464,13 @@ unpack_double(p, incr)
x /= 268435456.0; /* 2**28 */ x /= 268435456.0; /* 2**28 */
/* XXX This sadly ignores Inf/NaN */ /* XXX This sadly ignores Inf/NaN */
if (e != 0) if (e == 0)
x = ldexp(1.0 + x, e - 1023); e = -1022;
else {
x += 1.0;
e -= 1023;
}
x = ldexp(x, e);
if (s) if (s)
x = -x; x = -x;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment