Szabolcs Nagy | 8dba548 | 2013-09-04 17:36:00 +0000 | [diff] [blame] | 1 | #include <math.h> |
2 | #include <stdint.h> | ||||
Rich Felker | b69f695 | 2012-03-13 01:17:53 -0400 | [diff] [blame] | 3 | |
4 | double fabs(double x) | ||||
5 | { | ||||
Szabolcs Nagy | 8dba548 | 2013-09-04 17:36:00 +0000 | [diff] [blame] | 6 | union {double f; uint64_t i;} u = {x}; |
7 | u.i &= -1ULL/2; | ||||
8 | return u.f; | ||||
Rich Felker | b69f695 | 2012-03-13 01:17:53 -0400 | [diff] [blame] | 9 | } |