You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regression since #119: integer sums stall at round numbers. 10 + 2 == 10, 100 + 25 == 100, 20 - 3 == 20, and a sum += 2 loop stops at 10 #124
PreciseNumber normalizes integers by moving trailing zeros into the exponent: 10 becomes 1E1 and 100 becomes 1E2. Since fc66077 (#119, the fix for #107), CountDecimalDigits (SignificantNumber/SignificantNumber.cs:155) returns -value.Exponent without clamping it. As a result, any whole number ending in 0 is treated as known only to the tens or hundreds place, including one that came from int.ToSignificantNumber(). Add and Subtract then round the result to that place through LowestDecimalDigits (line 163 onward).
Failure scenarios
Measured at HEAD a15223e, then against fc66077^ in a worktree:
The last row shows what happens to an ordinary accumulator: once it reaches 10, every later + 2 rounds back to 10, so a running total of integer counts silently stops growing.
The full fix is the separate precision tracking proposed in #120. Until that lands, one of these:
Treat values from integer conversions (int/long/... ToSignificantNumber(), CreateChecked from integer types) as exact to the units place, i.e. clamp CountDecimalDigits to ≥ 0 for them. Only an explicit coarse input, such as Parse("1.2E3"), would then round to tens or hundreds.
Priority: High. Ordinary integer arithmetic silently returns wrong results (10 + 2 == 10), and accumulators stop growing. This is the library's core operation and fails with no error.
Area / suggested owner:CountDecimalDigits / LowestDecimalDigits in SignificantNumber.cs (@matt-edmondson).
An automated sweep set this aside before starting it. It's blocked on the same decision as #135 (see the triage there).
SignificantNumber holds only a PreciseNumber, so 10.ToSignificantNumber() and Parse("1E1") reach Add as identical operands, and CountDecimalDigits has nothing to branch on.
The clamp suggested here (CountDecimalDigits >= 0) would break this issue's own third acceptance criterion (Parse("1.2E3") + 34 == 1.2E3) and the pinned "1200" + "34" == 1.2E3 rows in SignificantNumberAdditionPlaceTests.
Activity
matt-edmondson commentedon Oct 5, 2026
Triage
10 + 2 == 10), and accumulators stop growing. This is the library's core operation and fails with no error.CountDecimalDigits/LowestDecimalDigitsinSignificantNumber.cs(@matt-edmondson).Parsewith*//, while this covers addition on integer conversions and the Round sums and differences to tens and hundreds when an operand is that coarse #119 regression. The interim clamp proposed here can ship before the full precision-tracking fix in Measured trailing zeros count as insignificant: Parse("1.20") has 2 sig figs, so 1.20 × 1.23456 = 1.5 and 9.81 × 10.0 = 100 #120. ++ and -- skip the addition rounding rule: 1.2E3++ gives 1201, while 1.2E3 + 1 gives 1200 #125 should land with or after this.Generated by Claude Code
matt-edmondson commentedon Nov 3, 2026
Triage
An automated sweep set this aside before starting it. It's blocked on the same decision as #135 (see the triage there).
SignificantNumberholds only aPreciseNumber, so10.ToSignificantNumber()andParse("1E1")reachAddas identical operands, andCountDecimalDigitshas nothing to branch on.CountDecimalDigits >= 0) would break this issue's own third acceptance criterion (Parse("1.2E3") + 34 == 1.2E3) and the pinned"1200" + "34" == 1.2E3rows inSignificantNumberAdditionPlaceTests.Decision needed: either accept the clamp and give up the #107 rule for now, or land #120 first. #125 and #135 follow whichever choice is made.
Left unassigned.
Generated by Claude Code