Repository navigation
Fix quantisation with constrained exponent limits - #157
Open
ryanduguid wants to merge 1 commit into
Open
ryanduguid wants to merge 1 commit into
ryanduguid wants to merge 1 commit into
Conversation
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.
Summary
Fixes #94: quantising
6410.000000000000000000to eight decimal places can returnNaNunder a valid currency context. The coefficient-rounding step uses a scaled temporary value whose exponent differs from the result. Apply system exponent limits to that temporary context, then validate the restored result under the caller's limits.The same helper also restores correct integral rounding in constrained contexts.
Evidence
Merge danger
Door: two-way. Blast radius: arithmetic.
Previously rejected valid amounts now return finite results and their proper rounding flags. Genuine precision and exponent violations still return
InvalidOperation, with trap behaviour covered by regressions.Unverified
Upstream CI requires maintainer approval; the Go workflow has no jobs. Native ARM hardware, the declared Go 1.17 runtime and timing equivalence have not been tested. Benchmark runs are smoke checks. Existing system-boundary quantisation counterexamples remain; original and patched receipts agree. PR #152 addresses the separate directed-rounding failure when retained precision is negative.