--- ray/src/common/tcos.c 2013/02/08 16:10:07 3.8 +++ ray/src/common/tcos.c 2013/07/12 05:16:02 3.10 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: tcos.c,v 3.8 2013/02/08 16:10:07 greg Exp $"; +static const char RCSid[] = "$Id: tcos.c,v 3.10 2013/07/12 05:16:02 greg Exp $"; #endif /* * Table-based cosine approximation. @@ -18,11 +18,12 @@ static const char RCSid[] = "$Id: tcos.c,v 3.8 2013/02 #include "rtmath.h" +#ifndef __FAST_MATH__ + #ifndef NCOSENTRY #define NCOSENTRY 1024 #endif - double tcos(double x) /* approximate cosine */ { @@ -51,6 +52,7 @@ tcos(double x) /* approximate cosine */ return(0.); /* should never be reached */ } +#endif /* Fast arctangent approximation due to Rajan et al. 2006 */ double @@ -64,7 +66,7 @@ atan2a(double y, double x) aratio = (ratio = y/x) >= 0 ? ratio : -ratio; if (aratio > 1.01) - return PI/2. - aatan2(x, y); + return PI/2. - atan2a(x, y); val = PI/4.*ratio - ratio*(aratio - 1.)*(0.2447 + 0.0663*aratio);