summary refs log tree commit diff
path: root/sysdeps/i386/fpu/e_log10.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386/fpu/e_log10.S')
-rw-r--r--sysdeps/i386/fpu/e_log10.S11
1 files changed, 10 insertions, 1 deletions
diff --git a/sysdeps/i386/fpu/e_log10.S b/sysdeps/i386/fpu/e_log10.S
index 2c8488c3a9..e93184c219 100644
--- a/sysdeps/i386/fpu/e_log10.S
+++ b/sysdeps/i386/fpu/e_log10.S
@@ -41,8 +41,12 @@ ENTRY(__ieee754_log10)
 1:	popl	%edx
 	addl	$_GLOBAL_OFFSET_TABLE_+[.-1b], %edx
 #endif
+	fxam
+	fnstsw
 	fld	%st		// x : x : log10(2)
-	fsubl	MO(one)		// x-1 : x : log10(2)
+	sahf
+	jc	3f		// in case x is NaN or ħInf
+4:	fsubl	MO(one)		// x-1 : x : log10(2)
 	fld	%st		// x-1 : x-1 : x : log10(2)
 	fabs			// |x-1| : x-1 : x : log10(2)
 	fcompl	MO(limit)	// x-1 : x : log10(2)
@@ -56,4 +60,9 @@ ENTRY(__ieee754_log10)
 2:	fstp	%st(0)		// x : log10(2)
 	fyl2x			// log10(x)
 	ret
+
+3:	jp	4b		// in case x is ħInf
+	fstp	%st(1)
+	fstp	%st(1)
+	ret
 END (__ieee754_log10)