[Haskell-cafe] Some More Sinus Results

Hans van Thiel hthiel.char at zonnet.nl
Sat Nov 10 12:56:23 EST 2007


Thanks to all who've replied; Carl's explanation in particular was very
interesting. So the precision, suggested by the many decimals in the
'show', is not the actual precision the user should 'count on'. If you
take 1/60 of a degree to be approximately 0.0003 radians, you should not
use sin for smaller values. In all cases the actual precision of sin
appears to be 4 to 5 decimals, and results should be rounded to that
before using them. Now I'm wondering about cos, tan and also the
inverses, asin etc. :-)

Regards,
Hans van Thiel

Hugs> sin (1.000 * pi)
1.22460635382238e-16
Hugs> sin (0.999 * pi)
0.00314158748587949
Hugs> sin (1.00001 * pi)
-3.14159265309255e-05
Hugs> sin (0.99999 * pi)
3.14159265307264e-05
Hugs> sin (1.001 * pi)
-0.00314158748587925
Hugs> sin (0.999 * pi)
0.00314158748587949
Hugs> sin (1.0001 * pi)
-0.000314159260191213
Hugs> sin (0.9999 * pi)
0.000314159260191458
Hugs> sin (1.00001 * pi)
-3.14159265309255e-05
Hugs> sin (1.0001 * pi)
-0.000314159260191213
Hugs> sin (0.9999 * pi)
0.000314159260191458
Hugs> sin (1.00001 * pi)
-3.14159265309255e-05
Hugs> sin (0.99999 * pi)
3.14159265307264e-05
Hugs> sin (6.0001 * pi)
0.000314159260189269
Hugs> sin (5.9999 * pi)
-0.000314159260190738
Hugs> sin (6.00001 * pi)
3.14159265298692e-05
Hugs> sin (5.99999 * pi)
-3.14159265313387e-05
Hugs> sin pi
1.22460635382238e-16



More information about the Haskell-Cafe mailing list