Hi
Where would I find the fromInt function, please?
Better still, would anyone know how to write a func for converting
int to float and vice versa?
Thanks, Paul
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/list
Hi Paul --
The function you want is called fromIntegral, and works for all Integral types.
Using it, you can add a type signature to specify what you want to
change the number to (Float, Double, other Integral type, etc.
Example:
> fromIntegral (4 :: Int) :: Double
4.0
Hope this helps!
--
Tom
To the tune of the theme song of Ghostbusters:
You've got an Int
But you want Double
Who do you call?
"fromIntegral!"
(The inverse conversion requires you to think about rounding first.)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www
Albert Y. C. Lai wrote:
To the tune of the theme song of Ghostbusters:
You've got an Int
But you want Double
Who do you call?
"fromIntegral!"
Let it never, *never* be said that math nerds don't have humour...
___
Haskell-Cafe mailing list
Haskell-Ca