
4 Feb
2009
4 Feb
'09
4:38 p.m.
Ross Mellgren ha scritto:
Prelude> let i2fDiv a b = fromIntegral a / fromIntegral b Prelude> :t i2fDiv i2fDiv :: (Integral a, Fractional b, Integral a1) => a -> a1 -> b Prelude> 10 `i2fDiv` 3 3.3333333333333335
Prelude> fac 777 `i2fDiv` fac 777 NaN
That what you're looking for?
No. I'm looking for an exact integer division that avoids overflows, if possible.
-Ross
Manlio Perillo