
26 Jan
2005
26 Jan
'05
9:09 p.m.
How can I convert an Int into a Double?
You don't convert to, you convert from :-) The function 'fromIntegral' is probably what you want.
And what function can I use to convert from Double to Int (the inverse of fromIntegral) ?
Use the functions in the RealFrac class. http://www.haskell.org/onlinereport/standard-prelude.html#$tRealFrac class (Real a, Fractional a) => RealFrac a where properFraction :: (Integral b) => a -> (b,a) truncate, round :: (Integral b) => a -> b ceiling, floor :: (Integral b) => a -> b J.A.