1 2 3 4 5 6 7 8 9 10 11 12
#include <math.h> #include <stdint.h> float fabsf(float x) { union { float f; uint32_t i; } u = { x }; u.i &= 0x7fffffff; return u.f; }