[Haskell-cafe] Newbie: Haskell Sine Oddities

ajb at spamcop.net ajb at spamcop.net
Mon May 1 03:19:41 EDT 2006


G'day all.

Aditya Siram wrote:

> > Prelude> sin pi
> > 1.22460635382238e-16  --WRONG!

Quoting Scott Turner <p.turner at computer.org>:

> This value, the computer's pi, differs from true pi by
>    0.000000000000000122...

Exercise for those doing numeric analysis 101: Explain why
these two numbers are approximately the same.

And if you found that one too easy, show how quickly
following iteration converges to pi.

    iterate (\x -> x + sin x) 1

Cheers,
Andrew Bromage


More information about the Haskell-Cafe mailing list