summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/math/fabs.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc-top-half/musl/src/math/fabs.c')
-rw-r--r--libc-top-half/musl/src/math/fabs.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/math/fabs.c b/libc-top-half/musl/src/math/fabs.c
new file mode 100644
index 0000000..e8258cf
--- /dev/null
+++ b/libc-top-half/musl/src/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;
+}