fix potentially wrong-sign zero in cproj functions at infinity
[musl] / src / math / fabsf.c
index 516f110..4efc8d6 100644 (file)
@@ -1,10 +1,9 @@
-#include "libm.h"
+#include <math.h>
+#include <stdint.h>
 
 float fabsf(float x)
 {
-       union fshape u;
-
-       u.value = x;
-       u.bits &= (uint32_t)-1 / 2;
-       return u.value;
+       union {float f; uint32_t i;} u = {x};
+       u.i &= 0x7fffffff;
+       return u.f;
 }