I found two small problem on cvt.s.d emulation.
1. Converting a denormalized number does not raise Inexact exception.
2. Any denormalized double precision numbers are converted to zero
regardless rounding mode. If rounding mode was "up", a positive
denormalized double precision number should be converted to minimal
(denormalized) single precision number.
Here is a patch.
--- linux-sgi-cvs/arch/mips/math-emu/sp_fdp.c Mon Oct 22 10:29:56 2001
+++ linux.new/arch/mips/math-emu/sp_fdp.c Thu Feb 14 18:56:06 2002
@@ -55,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;
---
Atsushi Nemoto
|