Update to use a new amendment, since this PR will not be part of 3.2.0

- This requires creating yet another MantissaScale, and CuspRoundingFix
  option.
This commit is contained in:
Ed Hennis
2026-06-09 16:43:24 -04:00
parent 693e9015ab
commit 2e97056b40
7 changed files with 83 additions and 55 deletions

View File

@@ -4766,11 +4766,10 @@ class Invariants_test : public beast::unit_test::Suite
std::vector<ValidVault::DeltaInfo> values;
};
for (auto const mantissaScale : {
MantissaRange::MantissaScale::LargeLegacy,
MantissaRange::MantissaScale::Large,
})
for (auto const mantissaScale : MantissaRange::getAllScales())
{
if (mantissaScale == MantissaRange::MantissaScale::Small)
continue;
NumberMantissaScaleGuard const g{mantissaScale};
auto makeDelta = [&vaultAsset](Number const& n) -> ValidVault::DeltaInfo {

View File

@@ -1399,8 +1399,7 @@ public:
"9223372036854775e3");
}
break;
case MantissaRange::MantissaScale::LargeLegacy:
case MantissaRange::MantissaScale::Large:
default:
// Test the edges
// ((exponent < -(28)) || (exponent > -(8)))))
test(Number::min(), "1e-32750");
@@ -1438,9 +1437,6 @@ public:
test(
-(Number{std::numeric_limits<std::int64_t>::max(), 0} + 1),
"-9223372036854775810");
break;
default:
BEAST_EXPECT(false);
}
}
@@ -1816,7 +1812,8 @@ public:
switch (scale)
{
case MantissaRange::MantissaScale::Large:
case MantissaRange::MantissaScale::Large3_2_0:
case MantissaRange::MantissaScale::LargeNew:
BEAST_EXPECT(signedDifference >= 0);
BEAST_EXPECT(signedDifference < pow10<BigInt>(product.exponent()));
BEAST_EXPECT(
@@ -1898,7 +1895,8 @@ public:
// Upward invariant: stored >= exact. Bug: stored < exact.
switch (scale)
{
case MantissaRange::MantissaScale::Large:
case MantissaRange::MantissaScale::Large3_2_0:
case MantissaRange::MantissaScale::LargeNew:
BEAST_EXPECT(stored >= exact);
BEAST_EXPECT(diff < pow10(quotient.exponent()));
break;
@@ -1948,7 +1946,8 @@ public:
// invariant: stored <= exact. Bug: stored > exact.
switch (scale)
{
case MantissaRange::MantissaScale::Large:
case MantissaRange::MantissaScale::Large3_2_0:
case MantissaRange::MantissaScale::LargeNew:
BEAST_EXPECT(stored <= exact);
BEAST_EXPECT(diff > -pow10(quotient.exponent()));
break;
@@ -2005,7 +2004,8 @@ public:
// invariant: stored >= exact. Bug: stored < exact.
switch (scale)
{
case MantissaRange::MantissaScale::Large:
case MantissaRange::MantissaScale::Large3_2_0:
case MantissaRange::MantissaScale::LargeNew:
BEAST_EXPECT(stored >= exact);
BEAST_EXPECT(diff < pow10(quotient.exponent()));
break;
@@ -2107,7 +2107,8 @@ public:
switch (scale)
{
case MantissaRange::MantissaScale::Small:
case MantissaRange::MantissaScale::LargeLegacy: {
case MantissaRange::MantissaScale::LargeLegacy:
case MantissaRange::MantissaScale::Large3_2_0: {
// Without the fix, all the results but one round up
if (r == Number::RoundingMode::Downward)
{