Viet-Trung Luu | 96b05c1 | 2016-01-11 11:26:36 -0800 | [diff] [blame] | 1 | #include <math.h> |
2 | #include <stdint.h> | ||||
3 | |||||
George Kulakowski | 17e3b04 | 2016-02-18 15:59:50 -0800 | [diff] [blame] | 4 | float fabsf(float x) { |
5 | union { | ||||
6 | float f; | ||||
7 | uint32_t i; | ||||
8 | } u = {x}; | ||||
9 | u.i &= 0x7fffffff; | ||||
10 | return u.f; | ||||
Viet-Trung Luu | 96b05c1 | 2016-01-11 11:26:36 -0800 | [diff] [blame] | 11 | } |