[Haskell-cafe] How to convert number types.
chaddai.fouche at gmail.com
Mon Dec 31 12:47:16 EST 2007
2007/12/31, L.Guo <leaveye.guo at gmail.com>:
> Hi MailList Haskell-Cafe:
> I am a new haskeller. And was farmilar with C.
> When tring to do some calculate, like this:
> input = 5 :: Int
> factor = 1.20 :: Float
> output = factor ** (toFloat input)
> I found that I do not know any function could do just what 'toFloat'
> should do.
> What should I do then ?
'fromIntegral' do 'toFloat' and others convertions.
But in your case, using (^) instead of (**) would probably be the good choice.
More information about the Haskell-Cafe