ciabatta/code/math/basic.c

35 lines
408 B
C
Raw Normal View History

2022-06-08 04:34:37 +00:00
2022-06-08 22:05:50 +00:00
#include <math.h>
double fabs(double x) {
if(x >= 0) {
return x;
}
return -x;
}
float fabsf(float x) {
if(x >= 0) {
return x;
}
return -x;
}
2022-06-08 04:34:37 +00:00
double fmod(double x, double y) {
int n = 0;
while(y < x*n) {
++n;
}
return y - n*x;
}
float fmodf(float x, float y) {
int n = 0;
while(y < x*n) {
++n;
}
return y - n*x;
}