# [racket] Possible bug with sine and cosine (simple floating-point issue?)

I'm running the Windows build of 5.0.2 on 32bit Windows 7 and I've run into
the following issues with sine and cosine. Here is a paste of my interaction
with Racket:
>* (inexact->exact (sin 0))
*0 ; fine
>* (inexact->exact (cos 0))
*1 ; fine
>* (inexact->exact (sin (/ pi 2)))
*1 ; fine
>* (inexact->exact (cos (/ pi 2)))
*0.0000000000000000612323399... ; should be 0
>* (inexact->exact (sin pi))
*0.0000000000000001224646799... ; should be 0
>* (inexact->exact (cos pi))
*-1 ; fine
>* (inexact->exact (sin (* 3 (/ pi 2))))
*-1 ; fine
>* (inexact->exact (cos (* 3 (/ pi 2))))
*-0.0000000000000001836970198... ; should be 0
>* (inexact->exact (sin (* 2 pi)))
*-0.0000000000000002449293598... ; should be 0
>* (inexact->exact (cos (* 2 pi)))
*1
Granted it is a very small amount to be off by and I doubt it's throwing off
my answers at all (working on exercise 27.1.4) just thought you should be
aware of it.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110106/2f4435b2/attachment.html>