Sine and Cosine Accuracy

Paul Koning pkoning@equallogic.com
Thu May 26 17:27:00 GMT 2005


>>>>> "Scott" == Scott Robert Ladd <scott.ladd@coyotegulch.com> writes:

 Scott> Richard Henderson wrote:
 >> On Thu, May 26, 2005 at 10:34:14AM -0400, Scott Robert Ladd wrote:
 >> 
 >>> static const double range = PI; // * 2.0; static const double
 >>> incr = PI / 100.0;
 >> 
 >> 
 >> The trig insns fail with large numbers; an argument reduction loop
 >> is required with their use.

 Scott> Yes, but within the defined mathematical ranges for sine and
 Scott> cosine -- [0, 2 * PI) -- the processor intrinsics are quite
 Scott> accurate.

Huh?  Sine and consine are mathematically defined for all finite
inputs. 

Yes, normally the first step is to reduce the arguments to a small
range around zero and then do the series expansion after that, because
the series expansion convergest fastest near zero.  But sin(100) is
certainly a valid call, even if not a common one.

	  paul



More information about the Gcc mailing list