diff options
Diffstat (limited to 'lib/mlibc/options/ansi/musl-generic-math/fabsf.c')
-rw-r--r-- | lib/mlibc/options/ansi/musl-generic-math/fabsf.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/mlibc/options/ansi/musl-generic-math/fabsf.c b/lib/mlibc/options/ansi/musl-generic-math/fabsf.c new file mode 100644 index 0000000..4efc8d6 --- /dev/null +++ b/lib/mlibc/options/ansi/musl-generic-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; +} |