aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-12-03 10:00:46 +0000
committerUlrich Drepper <drepper@redhat.com>2000-12-03 10:00:46 +0000
commit79569444efc685121f65d91f5b4eee834830d416 (patch)
tree05e776a4edd548651a6eca18eef62983c5ca7475 /sysdeps
parent06f55c0c1d28a6ef1462c54a94988112070a0c50 (diff)
downloadglibc-79569444efc685121f65d91f5b4eee834830d416.tar
glibc-79569444efc685121f65d91f5b4eee834830d416.tar.gz
glibc-79569444efc685121f65d91f5b4eee834830d416.tar.bz2
glibc-79569444efc685121f65d91f5b4eee834830d416.zip
Update.
2000-12-03 Ulrich Drepper <drepper@redhat.com> * math/test-misc.c (main): Add tests for frexp. Reported by Fred J. Tydeman <tydeman@tybor.com>. * sysdeps/i386/fpu/s_frexpl.S: Don't overflow during the computation.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/i386/fpu/s_frexpl.S20
1 files changed, 20 insertions, 0 deletions
diff --git a/sysdeps/i386/fpu/s_frexpl.S b/sysdeps/i386/fpu/s_frexpl.S
index cb943f74c2..2645d220ee 100644
--- a/sysdeps/i386/fpu/s_frexpl.S
+++ b/sysdeps/i386/fpu/s_frexpl.S
@@ -32,6 +32,12 @@
ASM_TYPE_DIRECTIVE(two64,@object)
two64: .byte 0, 0, 0, 0, 0, 0, 0xf0, 0x43
ASM_SIZE_DIRECTIVE(two64)
+ /* The following is LDBL_MAX / ldexp (1.0, 64), the largest
+ number we can handle the normal way. */
+ ASM_TYPE_DIRECTIVE(largest,@object)
+largest:
+ .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xbe, 0x7f, 0, 0
+ ASM_SIZE_DIRECTIVE(largest)
#ifdef PIC
#define MO(op) op##@GOTOFF(%edx)
@@ -63,12 +69,16 @@ ENTRY (BP_SYM (__frexpl))
cmpl $0, %eax
je 2f
+ cmpl $0x7fbe, %eax
+ ja 4f
+
fldt VAL0(%esp)
#ifdef PIC
call 3f
3: popl %edx
addl $_GLOBAL_OFFSET_TABLE_+[.-3b], %edx
#endif
+
fmull MO(two64) /* It's not necessary to use a 80bit factor */
movl $-64, %ecx
fstpt VAL0(%esp)
@@ -92,5 +102,15 @@ ENTRY (BP_SYM (__frexpl))
LEAVE
ret
+
+4: movl VAL2(%esp), %ecx
+ movl %ecx, %edx
+ andl $0x7fff, %ecx
+
+ andl $0x8000, %edx
+ subl $16382, %ecx
+ orl $0x3ffe, %edx
+ movl %edx, VAL2(%esp)
+ jmp 1b
END (BP_SYM (__frexpl))
weak_alias (BP_SYM (__frexpl), BP_SYM (frexpl))