unpacked: Use ResidualErrorOnRightShift in FPRoundBase

Fixes a bug relating to exponents that are severely out of range.
This commit is contained in:
MerryMage 2018-07-23 17:41:13 +01:00
parent 805428e35e
commit f17cd6f2c5
2 changed files with 24 additions and 13 deletions

View file

@ -75,3 +75,15 @@ TEST_CASE("FPUnpack<->FPRound Round-trip Tests", "[fp]") {
REQUIRE(input == output);
}
}
TEST_CASE("FPRound (near zero, round to posinf)", "[fp]") {
const FPUnpacked input = {false, -353, 0x0a98d25ace5b2000};
FPSR fpsr;
FPCR fpcr;
fpcr.RMode(RoundingMode::TowardsPlusInfinity);
const u32 output = FPRound<u32>(input, fpcr, fpsr);
REQUIRE(output == 0x00000001);
}