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 /cosine.c | |
parent | ed0bcc92f5101043fa9e09a1b7f66f339aaa177b (diff) |
clean up code
Diffstat (limited to 'cosine.c')
-rw-r--r-- | cosine.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -11,14 +11,15 @@ #include "format.h" #include "testData.h" +const int DEBUG = FALSE; + double cos(double input, int precision){ double ttl = 1; int denom = 1; double num; for (int i=2;i<=(2*precision);i+=2){ - num = mpow(input,i); + num = pow(input,i); denom *= i*(i-1); - // ttl += num/denom; ttl += ( (i/2)%2 == 0 ) ? num/denom : -num/denom; } return ttl; @@ -40,9 +41,11 @@ int main(){ cos(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; } |