#4383: Uncanonical display of Double
----------------------------------+-----------------------------------------
    Reporter:  daniel.is.fischer  |       Owner:                             
        Type:  bug                |      Status:  patch                      
    Priority:  normal             |   Component:  libraries/base             
     Version:  6.12.3             |    Keywords:  Double, show               
    Testcase:                     |   Blockedby:                             
          Os:  Unknown/Multiple   |    Blocking:                             
Architecture:  Unknown/Multiple   |     Failure:  Incorrect result at runtime
----------------------------------+-----------------------------------------
Changes (by daniel.is.fischer):

  * status:  new => patch


Comment:

 1. fix4383.dpatch fixes the issue, we no longer overestimate the base 10
 logarithm
  2. There was a typo (b instead of be) in the distance to the next smaller
 FP number for powers of floatRadix. I thought it ought to be `b^e` and
 verified it in the paper. This makes numrun012 fail because now `2 ^ 31 ::
 Float` shows as "2.1474836e9" instead of "2.1474837e9" (and some other
 show values change too, e.g. `2.0 ^ 852` was "3.0030067315218801e256" is
 now "3.00300673152188e256").
  3. Performance enhancement by using quot/quotRem instead of div/divMod
 and using the cache of powers of 2 instead of recomputing.
  4. Further performance enhancement by adding a cache for powers of 10.
  5. All of the above in one patch.

 1. and 2. should be applied since they correct errors.[[BR]]
 The performance enhancement isn't too bad, I think a few more percent
 could be squeezed out, but it doesn't solve the fundamental problem of the
 slowness of show for !RealFloat values (cf.
 http://www.haskell.org/pipermail/haskell-cafe/2009-June/062904.html). I
 plan to look into it for 7.2, not now.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4383#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to