linux-mips
[Top] [All Lists]

cvt.s.d emulation fix

To: linux-mips@oss.sgi.com
Subject: cvt.s.d emulation fix
From: Atsushi Nemoto <nemoto@toshiba-tops.co.jp>
Date: Thu, 14 Feb 2002 19:08:07 +0900 (JST)
Cc: ralf@oss.sgi.com
Organization: TOSHIBA Personal Computer System Corporation
Sender: owner-linux-mips@oss.sgi.com
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

<Prev in Thread] Current Thread [Next in Thread>
  • cvt.s.d emulation fix, Atsushi Nemoto <=