cosmopolitan/libc/math/fabs.c

11 lines
142 B
C
Raw Normal View History

2020-06-15 14:18:57 +00:00
#include "libc/math/math.h"
double fabs(double x) {
union {
double f;
uint64_t i;
} u = {x};
u.i &= -1ULL / 2;
return u.f;
}