diff options
author | das <das@FreeBSD.org> | 2007-01-06 21:50:04 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2007-01-06 21:50:04 +0000 |
commit | 24a4f9a492a711d87c7dc8b9fa8d83fad643734f (patch) | |
tree | 8f3913b231e8ec27b24516e434a3b7d66617568c /lib/libc/i386/gen | |
parent | 3d86fb6387a094e2d14a959794b86827ea91d03e (diff) | |
download | FreeBSD-src-24a4f9a492a711d87c7dc8b9fa8d83fad643734f.zip FreeBSD-src-24a4f9a492a711d87c7dc8b9fa8d83fad643734f.tar.gz |
Handle inf/nan correctly.
Diffstat (limited to 'lib/libc/i386/gen')
-rw-r--r-- | lib/libc/i386/gen/modf.S | 16 |
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 |