#3134: encodeFloat . decodeFloat
---------------------------------+------------------------------------------
    Reporter:  roland            |        Owner:                  
        Type:  bug               |       Status:  new             
    Priority:  normal            |    Milestone:  _|_             
   Component:  Prelude           |      Version:  6.10.1          
    Severity:  normal            |   Resolution:                  
    Keywords:                    |   Difficulty:  Unknown         
    Testcase:                    |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
---------------------------------+------------------------------------------
Changes (by simonmar):

  * difficulty:  => Unknown
  * milestone:  => _|_

Comment:

 Interesting, I thought we had a very old ticket about this, but I can't
 seem to find it.

 Anyway, I suppose the issue is what the representation of NaN and Infinity
 should be in the output of `decodeFloat`.  There is no provision for NaN
 and Infinity in the Haskell definition of `encodeFloat` and `decodeFloat`:

   The function decodeFloat applied to a real floating-point number returns
 the
   significand expressed as an Integer and an appropriately scaled exponent
 (an Int).
   If decodeFloat x yields (m,n), then x is equal in value to mbn, where b
 is the
   floating-point radix, and furthermore, either m and n are both zero or
 else
   bd-1<=m<bd, where d is the value of floatDigits x. encodeFloat performs
 the
   inverse of this transformation.

 from Section 6.4.6, [http://haskell.org/onlinereport/basic.html]

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