blob: e8258cfdbcf1a751621a69bac02f0f0f9b22b1cf [file] [log] [blame]
Szabolcs Nagy8dba5482013-09-04 17:36:00 +00001#include <math.h>
2#include <stdint.h>
Rich Felkerb69f6952012-03-13 01:17:53 -04003
4double fabs(double x)
5{
Szabolcs Nagy8dba5482013-09-04 17:36:00 +00006 union {double f; uint64_t i;} u = {x};
7 u.i &= -1ULL/2;
8 return u.f;
Rich Felkerb69f6952012-03-13 01:17:53 -04009}