summaryrefslogtreecommitdiffstats
path: root/lib/libc/i386/gen
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/i386/gen')
-rw-r--r--lib/libc/i386/gen/modf.S16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/libc/i386/gen/modf.S b/lib/libc/i386/gen/modf.S
index 426037b..031a788 100644
--- a/lib/libc/i386/gen/modf.S
+++ b/lib/libc/i386/gen/modf.S
@@ -53,6 +53,12 @@ __FBSDID("$FreeBSD$");
ENTRY(modf)
pushl %ebp
movl %esp,%ebp
+ /* Check for Inf/NaN */
+ movl 12(%ebp),%eax
+ andl $0x7fffffff,%eax
+ cmpl $0x7ff00000,%eax
+ jae 1f
+ /* Finite value */
subl $16,%esp
fnstcw -12(%ebp)
movw -12(%ebp),%dx
@@ -70,7 +76,13 @@ ENTRY(modf)
movl %ecx,4(%eax)
fldl 8(%ebp)
fsubl -8(%ebp)
- jmp L1
-L1:
+ leave
+ ret
+ /* Inf/NaN handling */
+1: fldl 8(%ebp)
+ movl 16(%ebp),%edx
+ fstl (%edx)
+ fldz
+ fdivp /* return +/- 0 for +/- Inf, NaN for NaN */
leave
ret
OpenPOWER on IntegriCloud