Skip to content

Commit

Permalink
handle correctly zero case, no need to raise 'inexact' exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav Shwartsman committed Nov 12, 2024
1 parent 961372d commit 3ee35f1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bochs/cpu/softfloat3e/f16_to_i8_r_minMag.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,13 @@ int8_t f16_to_i8_r_minMag(float16 a, bool exact, bool saturate, struct softfloat
sign = signF16UI(a);
exp = expF16UI(a);
sig = fracF16UI(a);
if (softfloat_denormalsAreZeros(status)) {
if (!exp && sig) return 0;
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
if (exp < 0xF) {
if (exact && (exp | sig)) {
softfloat_raiseFlags(status, softfloat_flag_inexact);
}
return 0;
}
/*------------------------------------------------------------------------
*------------------------------------------------------------------------*/
Expand Down

0 comments on commit 3ee35f1

Please sign in to comment.