summaryrefslogtreecommitdiff
path: root/cosine.c
diff options
context:
space:
mode:
Diffstat (limited to 'cosine.c')
-rw-r--r--cosine.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/cosine.c b/cosine.c
index 28996f0..85e062a 100644
--- a/cosine.c
+++ b/cosine.c
@@ -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;
}