Number conversions, like floats to doubles
Ben Escoto
bescoto at stanford.edu
Sat Nov 8 13:41:07 EST 2003
Quick and probably stupid question:
If I want to convert a Float to a Double, should I use
fromRational . toRational
? It seems to work, but isn't this a bit weird? It took a while for
me to figure this out. I suppose they are rationals because of the
finite precision of Floats and Doubles? And similarly, (fromInteger
. toInteger) is the right way to convert the integral types?
Why not just have a function like:
convertIntegral :: (Integral a, Integral b) => a -> b
--
Ben Escoto
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://haskell.org/pipermail/haskell/attachments/20031108/fcc5f37e/attachment.bin
More information about the Haskell
mailing list