diff options
Diffstat (limited to 'lib/mlibc/options/ansi/musl-generic-math/fabs.c')
-rw-r--r-- | lib/mlibc/options/ansi/musl-generic-math/fabs.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/mlibc/options/ansi/musl-generic-math/fabs.c b/lib/mlibc/options/ansi/musl-generic-math/fabs.c new file mode 100644 index 0000000..e8258cf --- /dev/null +++ b/lib/mlibc/options/ansi/musl-generic-math/fabs.c @@ -0,0 +1,9 @@ +#include <math.h> +#include <stdint.h> + +double fabs(double x) +{ + union {double f; uint64_t i;} u = {x}; + u.i &= -1ULL/2; + return u.f; +} |