> >> 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.

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to