Fix due to Bill Noon for problem discovered by Ken Manheimer: packing

0.0 as float or double would yield the representation for 1.0!
This commit is contained in:
Guido van Rossum 1997-11-04 17:12:33 +00:00
parent 25c649fdf2
commit 8f3c812e22
1 changed files with 2 additions and 2 deletions

View File

@ -167,7 +167,7 @@ pack_float(x, p, incr)
f = ldexp(f, 126 + e);
e = 0;
}
else {
else if (!(e == 0 && f == 0.0)) {
e += 127;
f -= 1.0; /* Get rid of leading 1 */
}
@ -239,7 +239,7 @@ pack_double(x, p, incr)
f = ldexp(f, 1022 + e);
e = 0;
}
else {
else if (!(e == 0 && f == 0.0)) {
e += 1023;
f -= 1.0; /* Get rid of leading 1 */
}