FPRoundInt: Final FPRound based on new sign
While this shouldn't change any of the results in theory, it's just logically more consistent
This commit is contained in:
parent
83be491875
commit
1dbe9d95e6
1 changed files with 3 additions and 2 deletions
|
@ -72,11 +72,12 @@ u64 FPRoundInt(FPT op, FPCR fpcr, RoundingMode rounding, bool exact, FPSR& fpsr)
|
||||||
int_result++;
|
int_result++;
|
||||||
}
|
}
|
||||||
|
|
||||||
const u64 abs_int_result = Common::MostSignificantBit(int_result) ? Safe::Negate<u64>(int_result) : static_cast<u64>(int_result);
|
const bool new_sign = Common::MostSignificantBit(int_result);
|
||||||
|
const u64 abs_int_result = new_sign ? Safe::Negate<u64>(int_result) : static_cast<u64>(int_result);
|
||||||
|
|
||||||
const FPT result = int_result == 0
|
const FPT result = int_result == 0
|
||||||
? FPInfo<FPT>::Zero(sign)
|
? FPInfo<FPT>::Zero(sign)
|
||||||
: FPRound<FPT>(FPUnpacked<u64>{sign, 0, abs_int_result}, fpcr, RoundingMode::TowardsZero, fpsr);
|
: FPRound<FPT>(FPUnpacked<u64>{new_sign, 0, abs_int_result}, fpcr, RoundingMode::TowardsZero, fpsr);
|
||||||
|
|
||||||
if (error != ResidualError::Zero && exact) {
|
if (error != ResidualError::Zero && exact) {
|
||||||
FPProcessException(FPExc::Inexact, fpcr, fpsr);
|
FPProcessException(FPExc::Inexact, fpcr, fpsr);
|
||||||
|
|
Loading…
Reference in a new issue