unsafeCoerce# between integral and floating point types

Ian Lynagh igloo at earth.li
Thu Jul 8 12:15:44 EDT 2010


On Thu, Jul 08, 2010 at 04:49:00PM +0200, Daniel Fischer wrote:
> 
> unsafeCoerce# :: Word64# -> Double# ?
> 
> By the docs, that isn't supposed to work. Is it not supposed to work only 
> because it's not value-preserving (unsafeCoerce# 1## /=## 1.0##) or are 
> there more pitfalls?

It can fail to compile, even; see
http://hackage.haskell.org/trac/ghc/ticket/2209

> If there are more pitfalls, is there any chance of getting a function which 
> reinterprets the bit-patterns?

There's a feature request for that here:
http://hackage.haskell.org/trac/ghc/ticket/4092


Thanks
Ian



More information about the Glasgow-haskell-users mailing list