Repository navigation
A complex number's modulus is made under the downcasting setting in force - #1619
Merged
Merged
Conversation
…orce Complex.Abs() turned the downcasting on to answer a Real, so with the downcasting off a modulus within its tolerance of a small rational came back as that rational: |75 + 316.22776601683796i|, which is 325 + 2.6e-17, was 325. It now builds the square root under the setting in force, as any other number is made. With the downcasting on nothing changes: the rounding is the setting's own. The complex division took its modulus through Abs(), and #1616 gave it a branch of its own for the downcasting off. With Abs() keeping the setting, the division calls it again, and the two agree by construction. #1616's comment, its breaking-changes entry and its test gave that modulus as 325 - 3e-16. It is 325 + 2.6e-17 (mpmath, 150 digits), a relative 8e-20 and not 2e-18, and all three are corrected here. The fix they describe stands: the modulus is still within the downcasting's tolerance of 325. Numeric gains the modulus with the downcasting off, through Abs() and through abs(...), against mpmath to 90 decimal places, and with it on, 325 as before. Closes #1615. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Complex.Abs()turned the downcasting on to answer aReal. So with the downcasting off, a modulus within its tolerance of a small rational came back as that rational:|75 + 316.22776601683796i|, which is325 + 2.6e-17, was325. It now builds the square root under the setting in force, as any other number is made. With the downcasting on nothing changes, since the rounding is the setting's own.The complex division took its modulus through
Abs(), and #1616 gave it a branch of its own for the downcasting off. WithAbs()keeping the setting, the division calls it again, and the two agree by construction.A correction. #1616's code comment, its breaking-changes entry and its test gave that modulus as
325 - 3e-16. It is325 + 2.6e-17(mpmath, 150 digits), a relative8e-20and not2e-18. All three are corrected here, and the #1616 description and the #1614 comment have been edited. The fix they describe stands, since the modulus is still within the downcasting's tolerance of 325. The squashed commit message on master keeps the old figure.Measured
"abs(75 + 316.22776601683796i)", downcasting off325325.000000000000026076735749…Numeric.AModulusIsMadeUnderTheDowncastingInForce: the modulus with the downcasting off, throughAbs()and throughabs(...), against mpmath to 90 decimal places; and with it on,325as before.SolveEasy's allocation rose 5.5% when the exact modulus was tried with the downcasting on during The factorial far from zero, and a quotient by a number whose modulus is nearly whole #1616. It is at the baseline's 453,621 B/op.Closes #1615.
🤖 Generated with Claude Code