about summary refs log tree commit diff
path: root/sysdeps/i386/fpu/e_powf.S
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2012-03-28 14:57:58 +0000
committerJoseph Myers <joseph@codesourcery.com>2012-03-28 14:57:58 +0000
commitd6270972f79fe89a96fa7a3909991dad2e317033 (patch)
tree18ed157e89359cf8711d641916028dab73e37449 /sysdeps/i386/fpu/e_powf.S
parent414fca039edfece0dc9bfc266730e390124687de (diff)
downloadglibc-d6270972f79fe89a96fa7a3909991dad2e317033.tar.gz
glibc-d6270972f79fe89a96fa7a3909991dad2e317033.tar.xz
glibc-d6270972f79fe89a96fa7a3909991dad2e317033.zip
Fix pow of negative numbers to integer exponents (bugs 369, 2678, 3866).
Diffstat (limited to 'sysdeps/i386/fpu/e_powf.S')
-rw-r--r--sysdeps/i386/fpu/e_powf.S9
1 files changed, 7 insertions, 2 deletions
diff --git a/sysdeps/i386/fpu/e_powf.S b/sysdeps/i386/fpu/e_powf.S
index aa58ed2b67..529a96f953 100644
--- a/sysdeps/i386/fpu/e_powf.S
+++ b/sysdeps/i386/fpu/e_powf.S
@@ -114,7 +114,7 @@ ENTRY(__ieee754_powf)
 	fucomp	%st(1)		// y : x
 	fnstsw
 	sahf
-	jne	2f
+	jne	3f
 
 	/* OK, we have an integer value for y.  */
 	popl	%edx
@@ -151,7 +151,12 @@ ENTRY(__ieee754_powf)
 
 	cfi_adjust_cfa_offset (4)
 	.align ALIGNARG(4)
-2:	/* y is a real number.  */
+2:	/* y is a large integer (so even).  */
+	fxch			// x : y
+	fabs			// |x| : y
+	fxch			// y : x
+	.align ALIGNARG(4)
+3:	/* y is a real number.  */
 	fxch			// x : y
 	fldl	MO(one)		// 1.0 : x : y
 	fldl	MO(limit)	// 0.29 : 1.0 : x : y