From: Peter Perkins <>
Newsgroups: comp.soft-sys.matlab
Subject: Re: cos(pi/2)   or    sin(-pi)   problem
Date: Mon, 19 Jan 2009 11:13:04 -0500
Organization: The MathWorks, Inc.
Lines: 5
Message-ID: <gl28qg$r$>
References: <> <gksq8p$61f$> <gkvt2k$4ab$> <gl052t$fhb$>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: 1232381584 27 (19 Jan 2009 16:13:04 GMT)
NNTP-Posting-Date: Mon, 19 Jan 2009 16:13:04 +0000 (UTC)
User-Agent: Thunderbird (Windows/20081209)
In-Reply-To: <gl052t$fhb$>
Xref: comp.soft-sys.matlab:512492

Roger Stafford wrote:

>   Strictly speaking that isn't quite true, Peter.  It is impossible for 'cos' and 'sin' to return the exactly correct values for angles which are only rational approximations to pi/2 and pi, respectively, because the exact answers would themselves be irrational.

Sure.  I mean "correct" in the sense that those values are the correct floating point values for the sin and cos of the floating point approximations to pi/2 and -pi.