From c9e317475a5bc349b39a1c5f3f68d59a4c6bc5c3 Mon Sep 17 00:00:00 2001 From: Barry Wardell Date: Sat, 17 Feb 2007 19:54:05 +0000 Subject: Accept FS#6662. Thanks to Nick Vanderweit. No need to define PI as it is already defined as M_PI in math.h. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12355 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/calculator.c | 17 ++++++++--------- docs/CREDITS | 2 ++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c index eb1e613ff1..108b17c9e8 100644 --- a/apps/plugins/calculator.c +++ b/apps/plugins/calculator.c @@ -228,7 +228,6 @@ enum { sci_fac, sci_pi , sci_sci , sci_sin , sci_asin , sci_0 , sci_sign , sci_dot , sci_log , sci_xy }; -#define PI 3.14159265358979323846 #define MINIMUM 0.000000000001 /* e-12 */ /* ^ ^ ^ ^ */ /* 123456789abcdef */ @@ -505,7 +504,7 @@ double mySqrt(double square) ----------------------------------------------------------------------- */ void transcendFunc(char* func, double* tt, int* ttPower) { - double t = (*tt)*PI/180; int tPower = *ttPower; + double t = (*tt)*M_PI/180; int tPower = *ttPower; int sign = 1; int n = 50; /* n <=50, tables are all <= 50 */ int j; @@ -539,15 +538,15 @@ void transcendFunc(char* func, double* tt, int* ttPower) tPower++; } j = 0; - while (t > j*2*PI) {j++;} - t -= (j-1)*2*PI; - if (PI/2 < t && t < 3*PI/2){ - t = PI - t; + while (t > j*M_TWOPI) {j++;} + t -= (j-1)*M_TWOPI; + if (M_PI_2 < t && t < 3*M_PI_2){ + t = M_PI - t; if (func[0] =='c' || func[0] =='C') sign = -1; } - else if ( 3*PI/2 <= t && t <= 2*PI) - t -= 2*PI; + else if ( 3*M_PI_2 <= t && t <= M_TWOPI) + t -= M_TWOPI; x = 0.60725293500888; y = 0; z = t; for (j=1;j