summaryrefslogtreecommitdiffstats
path: root/arch/mips/math-emu/dp_simple.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2006-02-07 15:16:27 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-02-07 15:16:27 -0500
commit5d1769ac3d0ea5ff3a286b097c21faaf6a9e6859 (patch)
tree63429c2222a55509dc81269233bbe7a321bb86ed /arch/mips/math-emu/dp_simple.c
parent23a56e2cbec2860ef02d6720508fbcb07accc8b4 (diff)
parentce4b50f2fc62267eeaf331c41bc11b92d9bc7865 (diff)
Merge branch 'master'
Diffstat (limited to 'arch/mips/math-emu/dp_simple.c')
-rw-r--r--arch/mips/math-emu/dp_simple.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/arch/mips/math-emu/dp_simple.c b/arch/mips/math-emu/dp_simple.c
index 495c1ac9429..1c555e6c6a9 100644
--- a/arch/mips/math-emu/dp_simple.c
+++ b/arch/mips/math-emu/dp_simple.c
@@ -48,16 +48,22 @@ ieee754dp ieee754dp_neg(ieee754dp x)
CLEARCX;
FLUSHXDP;
+ /*
+ * Invert the sign ALWAYS to prevent an endless recursion on
+ * pow() in libc.
+ */
+ /* quick fix up */
+ DPSIGN(x) ^= 1;
+
if (xc == IEEE754_CLASS_SNAN) {
+ ieee754dp y = ieee754dp_indef();
SETCX(IEEE754_INVALID_OPERATION);
- return ieee754dp_nanxcpt(ieee754dp_indef(), "neg");
+ DPSIGN(y) = DPSIGN(x);
+ return ieee754dp_nanxcpt(y, "neg");
}
if (ieee754dp_isnan(x)) /* but not infinity */
return ieee754dp_nanxcpt(x, "neg", x);
-
- /* quick fix up */
- DPSIGN(x) ^= 1;
return x;
}