[GHC] #5118: Numeric.floatToDigits fails for large floatRange

GHC cvs-ghc at haskell.org
Fri Apr 15 00:08:12 CEST 2011


#5118: Numeric.floatToDigits fails for large floatRange
--------------------------------+-------------------------------------------
    Reporter:  claudiusmaximus  |       Owner:                             
        Type:  bug              |      Status:  new                        
    Priority:  normal           |   Component:  libraries/base             
     Version:  6.12.3           |    Keywords:                             
    Testcase:                   |   Blockedby:                             
          Os:  Linux            |    Blocking:                             
Architecture:  x86_64 (amd64)   |     Failure:  Incorrect result at runtime
--------------------------------+-------------------------------------------
 I tried to write some high precision floating point datatype like this
 (corresponding to encodeFloat and decodeFloat format):
 {{{
 data HugeFloat = HugeFloat Integer Int
 }}}
 Mainly as an exercise to see how much slower it would be, but got failures
 trying to print the values (ghci would consume all available memory and be
 rather unresponsive w.r.t. ctrl-C input).

 Changing this line in my RealFloat instance from:
 {{{
   floatRange _ = (minBound, maxBound) -- fails
 }}}
 to:
 {{{
   floatRange _ = (minBound `div` 2, maxBound `div` 2) -- works
 }}}
 made the non-termination failures seemingly disappear.

 With attached code, ghci fails if I type:
 {{{
   > 771 :: F1
 }}}

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5118>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the Glasgow-haskell-bugs mailing list