patch-2.4.19 linux-2.4.19/arch/mips/math-emu/sp_fdp.c
Next file: linux-2.4.19/arch/mips/math-emu/sp_mul.c
Previous file: linux-2.4.19/arch/mips/math-emu/sp_div.c
Back to the patch index
Back to the overall index
- Lines: 44
- Date:
Fri Aug 2 17:39:43 2002
- Orig file:
linux-2.4.18/arch/mips/math-emu/sp_fdp.c
- Orig date:
Fri Apr 13 20:26:07 2001
diff -urN linux-2.4.18/arch/mips/math-emu/sp_fdp.c linux-2.4.19/arch/mips/math-emu/sp_fdp.c
@@ -30,20 +30,24 @@
ieee754sp ieee754sp_fdp(ieee754dp x)
{
COMPXDP;
+ ieee754sp nan;
+
+ EXPLODEXDP;
CLEARCX;
- EXPLODEXDP;
+ FLUSHXDP;
switch (xc) {
- case IEEE754_CLASS_QNAN:
case IEEE754_CLASS_SNAN:
- return ieee754sp_nanxcpt(buildsp(xs,
- SP_EMAX + 1 + SP_EBIAS,
- (unsigned long)
- (xm >>
- (DP_MBITS - SP_MBITS))),
- "fdp", x);
+ SETCX(IEEE754_INVALID_OPERATION);
+ return ieee754sp_nanxcpt(ieee754sp_indef(), "fdp");
+ case IEEE754_CLASS_QNAN:
+ nan = buildsp(xs, SP_EMAX + 1 + SP_EBIAS, (unsigned long)
+ (xm >> (DP_MBITS - SP_MBITS)));
+ if (!ieee754sp_isnan(nan))
+ nan = ieee754sp_indef();
+ return ieee754sp_nanxcpt(nan, "fdp", x);
case IEEE754_CLASS_INF:
return ieee754sp_inf(xs);
case IEEE754_CLASS_ZERO:
@@ -51,6 +55,10 @@
case IEEE754_CLASS_DNORM:
/* cant possibly be sp representable */
SETCX(IEEE754_UNDERFLOW);
+ SETCX(IEEE754_INEXACT);
+ if ((ieee754_csr.rm == IEEE754_RU && !xs) ||
+ (ieee754_csr.rm == IEEE754_RD && xs))
+ return ieee754sp_xcpt(ieee754sp_mind(xs), "fdp", x);
return ieee754sp_xcpt(ieee754sp_zero(xs), "fdp", x);
case IEEE754_CLASS_NORM:
break;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)