Significant rewrite

- Simplify Number::operator/= to use more constexpr values, and fewer
  variations.
  - Most significantly, rounding up doesn't need more precision, it only
    needs to know if there's a remainder after the current precision work
    is done. Tracked similarly Guard::xbit_.
- Build a constexpr lookup array for powers of 10. Only a handful of
  values are used, but since it's built at compile time, and constexpr,
  unused values do not affect memory or performance.
This commit is contained in:
Ed Hennis
2026-05-27 00:07:48 -04:00
parent 12670b0c3f
commit 5abecb9fcb
3 changed files with 194 additions and 66 deletions

View File

@@ -50,11 +50,15 @@ class Number_test : public beast::unit_test::Suite
{
T p = 1;
if (n >= 0)
{
for (int i = 0; i < n; ++i)
p *= 10;
}
else
{
for (int i = 0; i < -n; ++i)
p /= 10;
}
return p;
}