[Haskell-cafe] Newbie: Haskell Sine Oddities

Aditya Siram aditya_siram at hotmail.com
Sat Apr 29 13:36:03 EDT 2006


The Sine function in the prelude is not behaving as I expected. In the 
following Hugs session I tested sin on 0, 90,180 & 360 degrees.

Prelude> sin 0
0.0                                 --correct
Prelude> sin (pi/2)
1.0                                 --correct
Prelude> sin pi
1.22460635382238e-16  --WRONG!
Prelude> sin (2*pi)
-2.44921270764475e-16 --WRONG!

Is this normal behaviour? Or am I using the trig functions in an unexpected 
way?

Thanks...
Deech




More information about the Haskell-Cafe mailing list