Fix typo in floatToDigits
authorDaniel Fischer <daniel.is.fischer@web.de>
Sun, 24 Oct 2010 18:50:41 +0000 (18:50 +0000)
committerDaniel Fischer <daniel.is.fischer@web.de>
Sun, 24 Oct 2010 18:50:41 +0000 (18:50 +0000)
The mDn value for powers of 2 >= floatDigits x - 1 was typo'ed, leading to longer than necessary show results in a few cases (e.g. 2.0^852).
Corrected in accordance with Burger and Dybvig's paper.

GHC/Float.lhs

index aa2a534..e0cc415 100644 (file)
@@ -600,7 +600,7 @@ floatToDigits base x =
    if e >= 0 then
     let be = expt b e in
     if f == expt b (p-1) then
-      (f*be*b*2, 2*b, be*b, b)
+      (f*be*b*2, 2*b, be*b, be)     -- according to Burger and Dybvig
     else
       (f*be*2, 2, be, be)
    else