qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] softfloat: float32_to_float16() should do inexact i


From: Alexey Starikovskiy
Subject: [Qemu-devel] [PATCH] softfloat: float32_to_float16() should do inexact instead of underflow for rounding case
Date: Wed, 25 Apr 2012 20:11:42 +0400

See A2.7.7
Floating-point exceptions

Inexact. The flag is set to 1 if the result of an operation is not
equivalent to the value that
would be produced if the operation were performed with unbounded
precision and exponent
range.
Underflow. The flag is set to 1 if the absolute value of the result of
an operation, produced
before rounding, is less than the minimum positive normalized number
for the destination
precision, and the rounded result is inexact.

In this case we can see that the result is not less than the minimum
positive normalized number for the destination precision...

Signed-off-by: Alexey Starikovskiy <address@hidden>

---
 fpu/softfloat.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 9e1b5f9..8078f75 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -3067,7 +3067,7 @@ float16 float32_to_float16(float32 a, flag ieee
STATUS_PARAM)
         mask = 0x00001fff;
     }
     if (aSig & mask) {
-        float_raise( float_flag_underflow STATUS_VAR );
+        float_raise( float_flag_inexact STATUS_VAR );
         roundingMode = STATUS(float_rounding_mode);
         switch (roundingMode) {
         case float_round_nearest_even:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]