diff options
author | Benjamin Chausse <benjamin@chausse.xyz> | 2022-09-29 16:57:25 -0400 |
---|---|---|
committer | Benjamin Chausse <benjamin@chausse.xyz> | 2022-09-29 16:57:25 -0400 |
commit | 1d4ad135a43747041afb58f3cce586ceab94e39a (patch) | |
tree | 77be34e9832220686800c127969acf5acc6e8f23 /sine.c | |
parent | ed0bcc92f5101043fa9e09a1b7f66f339aaa177b (diff) |
clean up code
Diffstat (limited to 'sine.c')
-rw-r--r-- | sine.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -12,14 +12,14 @@ #include "format.h" #include "testData.h" -const int DEBUG = TRUE; +const int DEBUG = FALSE; double sin(double input, int precision){ double ttl = input; int denom = 1; double num; for (int i=3;i<(2*precision)+2;i+=2) { - num = mpow(input,i); + num = pow(input,i); denom *= i*(i-1); ttl += ((i-1)/2 %2 == 1) ? -num/denom : num/denom; } @@ -42,9 +42,11 @@ int main(){ sin(piValues[i][0],precision)); return 1; } else { - printf("%f IS ALL GOOD!\n",piValues[i][0]); + if (DEBUG){ + printf("%f IS ALL GOOD!\n",piValues[i][0]); + } } } - + printf("All checks have passed!\n"); return 0; } |