math: handle extreme orders in Jn and Yn - #81573
Open
cristiangirlea wants to merge 2 commits into
Open
cristiangirlea wants to merge 2 commits into
cristiangirlea wants to merge 2 commits into
Conversation
Use unsigned order magnitudes so MinInt can be represented, and convert recurrence coefficients to float64 before doubling them. Stop the backward recurrence when its scaling factor underflows, keeping the sign implied by the order and argument. This avoids an impractically long recurrence for inputs such as Jn(MaxInt, 1). Add tests for extreme orders, signs, special values, subnormal results, and large arguments where the result must not be forced to zero. Fixes golang#81489
Rename nn to absN in Jn and Yn to make the unsigned absolute order explicit. The type, arithmetic, control flow and tests are unchanged. Updates golang#81489
Contributor
|
This PR (HEAD: 2bd0f31) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/834144. Important tips:
|
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.
Use unsigned order magnitudes so MinInt can be represented, and convert
recurrence coefficients to float64 before doubling them.
Stop the backward recurrence when its scaling factor underflows, keeping
the sign implied by the order and argument. This avoids an impractically
long recurrence for inputs such as Jn(MaxInt, 1).
Add tests for extreme orders, signs, special values, subnormal results,
and large arguments where the result must not be forced to zero.
The existing recurrence is retained; enormous orders near the argument
can still require time proportional to the order.
The reported cases fail or time out before the fix and pass afterward.
Tests pass for math/..., with race and linux/386 checks for math.
A differential probe preserves 15,352 sampled outputs, and a separate
rational-series calculation checks the subnormal reference values.
The complete Go repository test suite was not run for this change.
Fixes #81489