summaryrefslogtreecommitdiff
path: root/libc/i386fp/fabs.x
diff options
context:
space:
mode:
Diffstat (limited to 'libc/i386fp/fabs.x')
-rw-r--r--libc/i386fp/fabs.x17
1 files changed, 17 insertions, 0 deletions
diff --git a/libc/i386fp/fabs.x b/libc/i386fp/fabs.x
new file mode 100644
index 0000000..fe81676
--- /dev/null
+++ b/libc/i386fp/fabs.x
@@ -0,0 +1,17 @@
+! bcc 386 floating point routines (version 2) -- _fabs
+! author: Bruce Evans
+
+#include "fplib.h"
+
+! double fabs(double value);
+! returns the absolute value of a number
+! this works for all NaNs, like the 80*87 fabs, but perhaps we should check
+! for exceptions that can happen when an 80*87 register is loaded
+
+ .globl _fabs
+ .align ALIGNMENT
+_fabs:
+ mov eax,PC_SIZE+D_LOW[esp]
+ mov edx,PC_SIZE+D_HIGH[esp]
+ and edx,~D_SIGN_MASK
+ ret