about summary refs log tree commit diff
path: root/sysdeps/x86_64/fpu/e_log2l.S
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/x86_64/fpu/e_log2l.S')
-rw-r--r--sysdeps/x86_64/fpu/e_log2l.S8
1 files changed, 7 insertions, 1 deletions
diff --git a/sysdeps/x86_64/fpu/e_log2l.S b/sysdeps/x86_64/fpu/e_log2l.S
index c12906d456..a063255ddd 100644
--- a/sysdeps/x86_64/fpu/e_log2l.S
+++ b/sysdeps/x86_64/fpu/e_log2l.S
@@ -78,7 +78,13 @@ ENTRY(__log2l_finite)
 	fnstsw			// x-1 : x : 1
 	andb	$0x45, %ah
 	jz	2b
-	fstp	%st(1)		// x-1 : 1
+	fxam
+	fnstsw
+	andb	$0x45, %ah
+	cmpb	$0x40, %ah
+	jne	6f
+	fabs			// log2(1) is +0 in all rounding modes.
+6:	fstp	%st(1)		// x-1 : 1
 	fyl2xp1			// log(x)
 	ret
 END (__log2l_finite)