[Haskell-cafe] Converting from Int to Double

Stefan Holdermans sholderm at students.cs.uu.nl
Wed Jan 26 15:06:21 EST 2005


Dmitri,

> And what function can I use to convert from Double to Int (the inverse 
> of
> fromIntegral) ?

You should really have a look at the Prelude and the Standard Libraries.

Well, it depends on *how* you want to convert.

truncate :: (RealFrac a, Integral b) => a -> b
round :: (RealFrac a, Integral b) => a -> b
floor :: (RealFrac a, Integral b) => a -> b
ceiling :: (RealFrac a, Integral b) => a -> b

HTH,

Stefan



More information about the Haskell-Cafe mailing list