summaryrefslogtreecommitdiff
path: root/src/math/fabs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/math/fabs.c')
-rw-r--r--src/math/fabs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/math/fabs.c b/src/math/fabs.c
new file mode 100644
index 00000000..6e28f1e5
--- /dev/null
+++ b/src/math/fabs.c
@@ -0,0 +1,10 @@
+#include "libm.h"
+
+double fabs(double x)
+{
+ union dshape u;
+
+ u.value = x;
+ u.bits &= (uint64_t)-1 / 2;
+ return u.value;
+}