-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix subnormal sqrt
and cbrt
#167
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #167 +/- ##
==========================================
+ Coverage 49.12% 49.19% +0.07%
==========================================
Files 63 63
Lines 3422 3425 +3
==========================================
+ Hits 1681 1685 +4
+ Misses 1741 1740 -1
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
for sqrt using
for cbrt using
will be faster (and shrinks the special case space). |
How are these subnormal numbers determined ? |
By hand. For example, at the end of the cbrt search
For cbrt, the value is not subnormal. |
I see, thanks. Especially since these numbers are determined from the output of algorithm itself, any change to the aforementioned algorithm is likely to change these values and thus breaking the code again: I find it error prone and brittle. |
For the algorithm as designed, they are the precise values -- changing the
design (esp for cbrt) would change that, but they are empirical. The
alternative would be to check the result for NaN and then apply the
approximation. That would be more general at the cost of slowdown
(checking all inputs for small inputs and checking results for small inputs
to see if they are NaN).
…On Wed, Mar 8, 2023 at 8:33 AM t-bltg ***@***.***> wrote:
I see, thanks.
Are we sure that we want to hardcode these numbers in the algorithm itself
?
Especially since these numbers are determined from the output of algorithm
itself, any change to the aforementioned algorithm is likely to change
these values and thus breaking the code again: I find it error prone and
brittle.
—
Reply to this email directly, view it on GitHub
<#167 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAM2VRSVGSDWNL6ZVHOIGLDW3CDCRANCNFSM6AAAAAAVTWICMY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
I've pushed an alternative in 5b99418, although I must admit that I find it less readable. |
What is |
y is an approximation to the final value x, 3.351952e153 was found by informed search.
|
Fix #166 (tests added).
Also remove
.DS_Store
files and add them to.gitignore
.PR
master