aboutsummaryrefslogtreecommitdiff
path: root/arch/mips/math-emu/sp_simple.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-02-10 16:51:29 +1100
committerPaul Mackerras <paulus@samba.org>2006-02-10 16:51:29 +1100
commitd6d93856cb90eeb07062ad938bd26f554bf1b9b9 (patch)
treeeeec5011a42f38d3dfe7b61788b7ac1cc890edeb /arch/mips/math-emu/sp_simple.c
parent8f75015f33c3005e0bbf83ffc0d5e0b4262cc03d (diff)
parentad71f123a9e9b809f6c829db1222ce0423a1153c (diff)
Merge ../powerpc-merge
Diffstat (limited to 'arch/mips/math-emu/sp_simple.c')
-rw-r--r--arch/mips/math-emu/sp_simple.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/mips/math-emu/sp_simple.c b/arch/mips/math-emu/sp_simple.c
index c809830dffb4..770f0f4677cd 100644
--- a/arch/mips/math-emu/sp_simple.c
+++ b/arch/mips/math-emu/sp_simple.c
@@ -48,16 +48,22 @@ ieee754sp ieee754sp_neg(ieee754sp x)
CLEARCX;
FLUSHXSP;
+ /*
+ * Invert the sign ALWAYS to prevent an endless recursion on
+ * pow() in libc.
+ */
+ /* quick fix up */
+ SPSIGN(x) ^= 1;
+
if (xc == IEEE754_CLASS_SNAN) {
+ ieee754sp y = ieee754sp_indef();
SETCX(IEEE754_INVALID_OPERATION);
- return ieee754sp_nanxcpt(ieee754sp_indef(), "neg");
+ SPSIGN(y) = SPSIGN(x);
+ return ieee754sp_nanxcpt(y, "neg");
}
if (ieee754sp_isnan(x)) /* but not infinity */
return ieee754sp_nanxcpt(x, "neg", x);
-
- /* quick fix up */
- SPSIGN(x) ^= 1;
return x;
}