#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 draconx):

 While it presumably goes against the report, I personally feel that
 floating point types do not belong as members of the Real class *at all*.
 The same is true for a number of other classes that they belong to.

 In the altfloat package, where I've been experimenting with solutions to
 this and other problems, I used a class

 {{{
 class FloatConvert a b where
     toFloating :: a -> b
 }}}

 which provides the necessary conversions: both between floating point
 types, and from real types to floating point types.  It should be noted
 that the functions `double2Float#` and `float2Double#` in GHC.Exts perform
 correct conversion.

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