Repository navigation
fix: handle scientific notation in multipleOf error aggregation - #290
Merged
jdesrosiers merged 3 commits intoOct 18, 2026
Merged
jdesrosiers merged 3 commits into
jdesrosiers merged 3 commits into
Conversation
jdesrosiers
requested changes
Oct 14, 2026
jdesrosiers
left a comment
Collaborator
There was a problem hiding this comment.
Thanks for finding this. I think there needs to be a more general solution. Other keywords like minimum and maximum could have the same issue, right?
Contributor
Author
|
@jdesrosiers true, multipleOf wasn’t the only one rounding tiny numbers into oblivion 😅 The bounds and success messages had the same issue. I have moved the formatting fix into the shared localization layer, keeping locale formatting and custom Fluent options intact. The BigInt arithmetic stays specific to multipleOf. Added regressions, trimmed some duplicate tests |
Use number arithmetic for the multipleOf LCM, with decimal counting that understands exponent notation. When a scaled value or the LCM is outside the safe integer range, fall back to the individual errors. Skip the LCM when there is only one multipleOf. Format message numbers with a plain FluentNumber instead of a custom subclass. No translation uses NUMBER() or plural selection on these values. Move test coverage into the JSON test suite and remove the standalone test files, along with tests for exact results outside the safe integer range. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jdesrosiers
force-pushed
the
fix/289-multipleof-scientific-notation
branch
from
October 18, 2026 22:00
9e83c1f to
c67ace0
Compare
jdesrosiers
approved these changes
Oct 18, 2026
jdesrosiers
left a comment
Collaborator
There was a problem hiding this comment.
I simplified the implementation because we know we won't have to deal with BigInts. I also moved tests to the JSON suite.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #289.
Calculate combined multiples using exact decimal integer arithmetic, handling scientific notation, mixed precision, and intermediate overflow. Report individual failing constraints when the combined result cannot be represented without precision loss. Preserve localized formatting without rounding small multiples to zero.
Add regression coverage for constraint interactions, locations, localization, and numeric limits. Confirmed the original regression fails before the fix. All 1,416 tests, lint, type
checking, and whitespace checks pass on Node 24.21.0.
The test coverage ended up being a bit larger than the implementation itself, since I tried to cover the numeric edge cases and interactions between constraints. Iam not entirely sure if all of these cases need separate tests, so I am happy to simplify or consolidate them if that would be easier to maintain.