[GHC] #3676: realToFrac doesn't sanely convert between floating types

GHC trac at galois.com
Thu Feb 11 05:12:03 EST 2010


#3676: realToFrac doesn't sanely convert between floating types
----------------------------------+-----------------------------------------
    Reporter:  draconx            |        Owner:  simonmar    
        Type:  bug                |       Status:  assigned    
    Priority:  normal             |    Milestone:  6.12.2      
   Component:  libraries (other)  |      Version:  6.12.1      
    Keywords:                     |   Difficulty:              
          Os:  Unknown/Multiple   |     Testcase:              
Architecture:  x86_64 (amd64)     |      Failure:  None/Unknown
----------------------------------+-----------------------------------------

Comment(by simonmar):

 I think it's pretty straightforward.  `toRational` should be able to
 convert NaN, Infinity and -Infinity correctly to Rational, and there is
 already code in fromRational to convert them back to the floating point
 types correctly (I imagine it's there in order to make things like `read
 "NaN"` work).

 The Haskell report doesn't say anything about the implementation of
 `toRational`, so I think this is correct.  I'm validating a patch now.

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


More information about the Glasgow-haskell-bugs mailing list