about summary refs log tree commit diff
path: root/sysdeps/i386/fpu/e_log10f.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/i386/fpu/e_log10f.S')
-rw-r--r--sysdeps/i386/fpu/e_log10f.S11
1 files changed, 10 insertions, 1 deletions
diff --git a/sysdeps/i386/fpu/e_log10f.S b/sysdeps/i386/fpu/e_log10f.S
index 2c07161085..0a89f54784 100644
--- a/sysdeps/i386/fpu/e_log10f.S
+++ b/sysdeps/i386/fpu/e_log10f.S
@@ -42,8 +42,12 @@ ENTRY(__ieee754_log10f)
 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)
@@ -57,4 +61,9 @@ ENTRY(__ieee754_log10f)
 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_log10f)