
4 Feb
2009
4 Feb
'09
5:26 p.m.
Max Rabkin ha scritto:
[...]
Here is an Haskell version: http://paste.pocoo.org/show/102801/
On my system it takes 30 seconds.
You're only dividing integers by integers to get Doubles.
x /. y = fromIntegral x / fromIntegral y
works just fine in this case.
No, this *does not works*. I get Nan as result, since fromIntegral a, when a is out of range of a double, returns Infinity. Prelude> (fromIntegral (fac 777)) :: Double Infinity CPython, does not try to convert to double, but, instead, to a scaled double.
--Max
Manlio Perillo