summaryrefslogtreecommitdiff
path: root/sine.c
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2022-09-29 16:57:25 -0400
committerBenjamin Chausse <benjamin@chausse.xyz>2022-09-29 16:57:25 -0400
commit1d4ad135a43747041afb58f3cce586ceab94e39a (patch)
tree77be34e9832220686800c127969acf5acc6e8f23 /sine.c
parented0bcc92f5101043fa9e09a1b7f66f339aaa177b (diff)
clean up code
Diffstat (limited to 'sine.c')
-rw-r--r--sine.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sine.c b/sine.c
index a6f0053..f221b5b 100644
--- a/sine.c
+++ b/sine.c
@@ -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;
}