[Haskell-beginners] Performance of Idiomatic lazy Haskell
Daniel Fischer
daniel.is.fischer at web.de
Sun Jan 31 15:43:12 EST 2010
Am Sonntag 31 Januar 2010 20:22:56 schrieb Stephen Tetley:
> On my machine, they diverged at the eighth decimal place -
>
> Leibniz4 3.1415926526069526
> Leibniz1 3.1415926445727678
Ah, that. I thought you were talking about timings.
There are several things that can lead to differing results here,
1) order of summation (I think only my loop had a different order)
2) due to different tests, it might happen that one algorithm evaluates one
term more than the other
3) are intermediate results truncated to 64 bits or kept in an 80-bit
register?
I'm astonished by the size of the difference, though.
But if you sum from small to large, the results are very accurately the
theoretically expected results, so I think it's 1) together with 3) which
make the difference.
More information about the Beginners
mailing list