int to float haskell
-- Int to Float -- Useing (/) (/) :: Fractional a => a -> a -> a {- The following code works: -} percent :: Int -> Int -> Float percent x y = 100 * ( a / b ) where a = fromIntegral x :: Float b = fromIntegral y :: Float
haskell float to int
-- Float to Int toInt :: Float -> Int toInt x = round x
Source: stackoverflow.com