diff options
| author | Barry Wardell <rockbox@barrywardell.net> | 2007-02-17 19:54:05 +0000 |
|---|---|---|
| committer | Barry Wardell <rockbox@barrywardell.net> | 2007-02-17 19:54:05 +0000 |
| commit | c9e317475a5bc349b39a1c5f3f68d59a4c6bc5c3 (patch) | |
| tree | f82a803d86d709a29671feac9ffb8b2e684a4b22 /apps/plugins | |
| parent | dbd7fd81f2f5c299f9677f4dd649a080c31ce357 (diff) | |
| download | rockbox-c9e317475a5bc349b39a1c5f3f68d59a4c6bc5c3.zip rockbox-c9e317475a5bc349b39a1c5f3f68d59a4c6bc5c3.tar.gz rockbox-c9e317475a5bc349b39a1c5f3f68d59a4c6bc5c3.tar.bz2 rockbox-c9e317475a5bc349b39a1c5f3f68d59a4c6bc5c3.tar.xz | |
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
Diffstat (limited to 'apps/plugins')
| -rw-r--r-- | apps/plugins/calculator.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c index eb1e613..108b17c 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<n+2;j++){ @@ -1309,7 +1308,7 @@ void sciButtonsProcess(void){ switch( CAL_BUTTON ){ case sci_pi: - result = PI; power = 0; + result = M_PI; power = 0; calStatus = cal_normal; break; |