summaryrefslogtreecommitdiffstats
path: root/libc-top-half/musl/src/math/fabsf.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc-top-half/musl/src/math/fabsf.c')
-rw-r--r--libc-top-half/musl/src/math/fabsf.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/math/fabsf.c b/libc-top-half/musl/src/math/fabsf.c
new file mode 100644
index 0000000..4efc8d6
--- /dev/null
+++ b/libc-top-half/musl/src/math/fabsf.c
@@ -0,0 +1,9 @@
+#include <math.h>
+#include <stdint.h>
+
+float fabsf(float x)
+{
+ union {float f; uint32_t i;} u = {x};
+ u.i &= 0x7fffffff;
+ return u.f;
+}