From haskell-cafe Wed Jan 26 21:09:17 2005 From: Jorge Adriano Aires Date: Wed, 26 Jan 2005 21:09:17 +0000 To: haskell-cafe Subject: Re: [Haskell-cafe] Converting from Int to Double Message-Id: <200501262109.17193.jadrian () mat ! uc ! pt> X-MARC-Message: https://marc.info/?l=haskell-cafe&m=120491995439790 > >> 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.