![]() |
|
|||||
|
||||||
Subject: Re: Barrie Hudson Challenge
From: Dan Allen (danallen46@XXX.XXX)
Date: Sat Nov 09 2002 - 13:46:45 EST
On Saturday, November 9, 2002, at 01:38 AM, Peter Fogg wrote:
> I have no idea why the course is different.
It is due to trig rounding problems. Cos(n) as n approaches zero, or
Sin(n) as n approaches 90 degrees are interesting to watch converge to
1.
Using high accuracy 80-bit trig functions (accurate to 1 ulp at 18
decimal digits):
Cos(0.1) = 0.999998476913287699
Cos(0.01) = 0.999999984769129049
Cos(0.001) = 0.999999999847691290
Cos(0.0001) = 0.999999999998476913
Note that with each factor of ten in the argument (.1 to .01, .01 to
.001, etc.) the result is 100 times closer to unity!
If you have arguments in your equations which approach zero as an
argument to cosine or approach 90 degrees as an argument to sine, it is
often best to use the complement functions to maintain accuracy.
Dan
|