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

From: Hendrik Boom (hendrik at topoi.pooq.com)
Date: Thu Jan 6 23:00:05 EST 2011

On Thu, Jan 06, 2011 at 10:41:48PM -0500, Sam Griff wrote:
> 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:
...
...
> 
> 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.

Welcome to floating-point arithmetic.

I once had a machine in which cos(0) was equal to 1, but cos(0) squared 
was unequal to 1 squared.

-- hendrik


Posted on the users mailing list.