summaryrefslogtreecommitdiff
path: root/format.h
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2022-09-29 16:42:58 -0400
committerBenjamin Chausse <benjamin@chausse.xyz>2022-09-29 16:42:58 -0400
commiteae5d5b8d55f5da69eea990e68497dbc0e74c9f3 (patch)
tree4dc2346c652db653320e27054a69c3aa8aa790af /format.h
parente8364e95ee1b38e49af29a2aa1338b3d978411f0 (diff)
Fix sine and cosine by increasing presicion
Diffstat (limited to 'format.h')
-rw-r--r--format.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/format.h b/format.h
index 3d51c3c..d4d1c8b 100644
--- a/format.h
+++ b/format.h
@@ -21,7 +21,7 @@ const char caps[2][26] = {
'n','o','p','q','r','s','t','u','v','w','x','y','z'}
};
-float mpow(float b, int e){
+double mpow(double b, int e){
if (e==1){
return b;
} else if (e%2==0){
@@ -31,9 +31,9 @@ float mpow(float b, int e){
}
}
-float avg(float arr[]){
+double avg(double arr[]){
int len = COUNT_OF(arr);
- float sum = 0;
+ double sum = 0;
for (int i=0;i<len;i++){
sum += arr[i];
}
@@ -75,6 +75,6 @@ char * trim(char *str){
return nstr;
}
-float abs(float i){
+double abs(double i){
return (i>0) ? i : -i;
}