Many floating point documentation/behaviour mismatches.
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.
Trac metadata
Trac field | Value |
---|---|
Version | 6.12.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/base |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |