[Haskell-fr] Fractional etc...
Chaddaï Fouché
chaddai.fouche at gmail.com
Tue Oct 30 06:50:47 EDT 2007
Le 30/10/07, Dupont Corentin<corentin.dupont at gmail.com> a écrit :
>
> There must be a way to divide a real by an integer??
> My integer is eventually a "number of elements" as in the exemple of Dan.
> How would you compute a mean then?
>
No, you can't "divide a real by an integer", but you can introduce the
integer in the reals and divide by this.
divideByI :: (Fractional a, Integral b) => a -> b -> a
divideByI a b = a / fromIntegral b
--
Jedaï
More information about the Haskell-fr
mailing list