mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-03 13:14:42 +01:00
fp: Fix FPToFixed for borderline values
This commit is contained in:
parent
f3af94bc7c
commit
4f3ef50d5c
2 changed files with 19 additions and 1 deletions
|
|
@ -38,3 +38,20 @@ TEST_CASE("FPToFixed", "[fp]") {
|
|||
REQUIRE(fpsr.Value() == expected_fpsr);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("FPToFixed edge cases", "[fp]") {
|
||||
const std::vector<std::tuple<u64, u64, bool, FP::RoundingMode>> test_cases{
|
||||
{0x41dffffffffffffe, 0x7fffffff, false, FP::RoundingMode::ToNearest_TieEven},
|
||||
{0x41dffffffffffffe, 0x7fffffff, false, FP::RoundingMode::TowardsPlusInfinity},
|
||||
{0x41dffffffffffffe, 0x7fffffff, false, FP::RoundingMode::TowardsMinusInfinity},
|
||||
{0x41dffffffffffffe, 0x7fffffff, false, FP::RoundingMode::TowardsZero},
|
||||
{0x41dffffffffffffe, 0x7fffffff, false, FP::RoundingMode::ToNearest_TieAwayFromZero},
|
||||
};
|
||||
|
||||
const FPCR fpcr;
|
||||
FPSR fpsr;
|
||||
for (auto [input, expected_output, unsigned_, rounding_mode] : test_cases) {
|
||||
const u64 output = FPToFixed<u64>(32, input, 0, unsigned_, fpcr, rounding_mode, fpsr);
|
||||
REQUIRE(output == expected_output);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue