summaryrefslogtreecommitdiff
path: root/apps/plugins/calculator.c
diff options
context:
space:
mode:
authorBarry Wardell <rockbox@barrywardell.net>2007-02-17 19:54:05 +0000
committerBarry Wardell <rockbox@barrywardell.net>2007-02-17 19:54:05 +0000
commitc9e317475a5bc349b39a1c5f3f68d59a4c6bc5c3 (patch)
treef82a803d86d709a29671feac9ffb8b2e684a4b22 /apps/plugins/calculator.c
parentdbd7fd81f2f5c299f9677f4dd649a080c31ce357 (diff)
downloadrockbox-c9e317475a5bc349b39a1c5f3f68d59a4c6bc5c3.tar.gz
rockbox-c9e317475a5bc349b39a1c5f3f68d59a4c6bc5c3.zip
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/calculator.c')
-rw-r--r--apps/plugins/calculator.c17
1 files changed, 8 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 ,
228 sci_0 , sci_sign , sci_dot , sci_log , sci_xy 228 sci_0 , sci_sign , sci_dot , sci_log , sci_xy
229 }; 229 };
230 230
231#define PI 3.14159265358979323846
232#define MINIMUM 0.000000000001 /* e-12 */ 231#define MINIMUM 0.000000000001 /* e-12 */
233 /* ^ ^ ^ ^ */ 232 /* ^ ^ ^ ^ */
234 /* 123456789abcdef */ 233 /* 123456789abcdef */
@@ -505,7 +504,7 @@ double mySqrt(double square)
505----------------------------------------------------------------------- */ 504----------------------------------------------------------------------- */
506void transcendFunc(char* func, double* tt, int* ttPower) 505void transcendFunc(char* func, double* tt, int* ttPower)
507{ 506{
508 double t = (*tt)*PI/180; int tPower = *ttPower; 507 double t = (*tt)*M_PI/180; int tPower = *ttPower;
509 int sign = 1; 508 int sign = 1;
510 int n = 50; /* n <=50, tables are all <= 50 */ 509 int n = 50; /* n <=50, tables are all <= 50 */
511 int j; 510 int j;
@@ -539,15 +538,15 @@ void transcendFunc(char* func, double* tt, int* ttPower)
539 tPower++; 538 tPower++;
540 } 539 }
541 j = 0; 540 j = 0;
542 while (t > j*2*PI) {j++;} 541 while (t > j*M_TWOPI) {j++;}
543 t -= (j-1)*2*PI; 542 t -= (j-1)*M_TWOPI;
544 if (PI/2 < t && t < 3*PI/2){ 543 if (M_PI_2 < t && t < 3*M_PI_2){
545 t = PI - t; 544 t = M_PI - t;
546 if (func[0] =='c' || func[0] =='C') 545 if (func[0] =='c' || func[0] =='C')
547 sign = -1; 546 sign = -1;
548 } 547 }
549 else if ( 3*PI/2 <= t && t <= 2*PI) 548 else if ( 3*M_PI_2 <= t && t <= M_TWOPI)
550 t -= 2*PI; 549 t -= M_TWOPI;
551 550
552 x = 0.60725293500888; y = 0; z = t; 551 x = 0.60725293500888; y = 0; z = t;
553 for (j=1;j<n+2;j++){ 552 for (j=1;j<n+2;j++){
@@ -1309,7 +1308,7 @@ void sciButtonsProcess(void){
1309 switch( CAL_BUTTON ){ 1308 switch( CAL_BUTTON ){
1310 1309
1311 case sci_pi: 1310 case sci_pi:
1312 result = PI; power = 0; 1311 result = M_PI; power = 0;
1313 calStatus = cal_normal; 1312 calStatus = cal_normal;
1314 break; 1313 break;
1315 1314