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

 The problem with non-overloaded functions is that there are a lot of them:
 12 with the four floating types that currently exist, and 30 if long
 double is ever added (two types: LDouble & CLDouble).  This problem could
 be mitigated by only providing the trivial conversions when FFI types are
 involved: that is, provide Double <=> CDouble, but don't bother with Float
 <=> CDouble.

 On the other hand, we could use a single parameter version of altfloat's
 technique as follows:

 {{{
 class FloatConvert a where
     toDouble :: a -> Double
 }}}

 since Double can represent all values of every other floating type (at
 least until long double exists).  Then we could have a `fromDouble` member
 in the RealFloat class, and define `toFloating = fromDouble . toDouble`

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