{{ message }}
<complex>: Improve numerical accuracy of sqrt and log#935
Merged
StephanTLavavej merged 24 commits intoNov 9, 2020
Conversation
3530c76 to
962917c
Compare
962917c to
5d43a74
Compare
Modifies the scale factors in `_Fabs` (used by `sqrt`) such that: - `_Fabs` doesn't underflow when the input is tiny. - `sqrt` doesn't overflow when the input is huge.
When |z| is close to 1, compute log(|z|) as log1p(norm_minus_1(z)) / 2, where norm_minus_1(z) = real(z) ^ 2 + imag(z) ^ 2 - 1 computed with double width arithmetic to avoid catastrophic cancellation.
5d43a74 to
a6a5934
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
statementreply
commented
Aug 27, 2020
statementreply
commented
Aug 27, 2020
cbezault
suggested changes
Sep 2, 2020
Co-authored-by: Curtis J Bezault <curtbezault@gmail.com>
This comment has been minimized.
This comment has been minimized.
StephanTLavavej
left a comment
Member
There was a problem hiding this comment.
This looks good to me! 😺 I'll validate and push changes for a number of superficial issues that I noticed, nothing affecting the core logic.
StephanTLavavej
approved these changes
Nov 4, 2020
This comment has been minimized.
This comment has been minimized.
StephanTLavavej
added a commit
to StephanTLavavej/STL
that referenced
this pull request
Nov 5, 2020
Member
Member
|
I've pushed a merge, resolving conflicts with the test harness rewrite. The This doesn't do anything about |
Member
Changelog
|
StephanTLavavej
approved these changes
Nov 9, 2020
cbezault
approved these changes
Nov 9, 2020
Member
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.

Goals:
sqrtoverflow when input is huge.sqrtinaccuracy when input is tiny, due to internal underflow.loginaccuracy when input is tiny, due to internal underflow.logwhen |z| ≈ 1, and fixlog(complex<float>{1, 0}) != 0under certain combinations of compile time and runtime settings. (DevCom-1093507 is a symptom of the inaccuracy. It is itself non-bug.)arm/arm64 when available.The changes contain algorithm described in W. Kahan (1987), Branch Cuts for Complex Elementary Functions, or Much Ado About Nothing's Sign Bit.