#3898: Many floating point documentation/behaviour mismatches.
---------------------------------+------------------------------------------
    Reporter:  draconx           |       Owner:                
        Type:  bug               |      Status:  new           
    Priority:  normal            |   Component:  libraries/base
     Version:  6.12.1            |    Keywords:                
          Os:  Unknown/Multiple  |    Testcase:                
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown  
---------------------------------+------------------------------------------
 I was looking at the haddock documentation for the Prelude to find out
 what the heck isIEEE did (which didn't actually help: what makes a value
 an "IEEE floating point number"?  I'm guessing it is a constant function
 which indicates conformance of the _type_ to a particular standard), when
 I found a number of mismatches between the documentation and the
 behaviour.

 * The documentation for scaleFloat says "multiplies a floating point
 number by an integer power of the radix".  But it doesn't do this:

 {{{
 floatRadix (1/0)
 --> 2

 1/0 * 2^^(-1)
 --> Infinity

 scaleFloat (-1) (1/0)
 --> 8.98846567431158e307
 }}}

 In this case, I consider the documentation correct and the implementation
 wrong: scaleFloat should behave similarly to C's scalbln.

 * The documentation for exponent says "the second component of
 decodeFloat".

 {{{
 decodeFloat 5
 --> (5629499534213120,-50)

 exponent 5
 --> 3
 }}}

 In this case, it is probably just the documentation that is wrong.

 * The documentation for encodeFloat says "performs the inverse of
 decodeFloat".

 {{{
 id $ 0/0
 --> NaN

 uncurry encodeFloat . decodeFloat $ 0/0
 --> -Infinity
 }}}

 In this case, I'm not sure which is wrong.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3898>
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