use the definition of FPdbleword to avoid having to recreate system-dependent details about fp numbers Reference: /n/atom/patch/applied2013/fabs Date: Wed Jun 19 06:06:37 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/libc/port/fabs.c Wed Jun 19 06:06:10 2013 +++ /sys/src/libc/port/fabs.c Wed Jun 19 06:06:10 2013 @@ -1,14 +1,11 @@ #include #include -#define SIGN (1<<31) - double fabs(double arg) { - FPdbleword x; - x.x = arg; - x.hi &= ~SIGN; - return x.x; + if(arg < 0) + return -arg; + return arg; }