-
Notifications
You must be signed in to change notification settings - Fork 5.8k
JDK-8301392: Port fdlibm log1p to Java #12301
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
Conversation
👋 Welcome back darcy! A progress list of the required criteria for merging this PR into |
Webrevs
|
@@ -779,7 +780,6 @@ public static double compute(double x) { | |||
* shown. | |||
*/ | |||
static class Log10 { | |||
private static double two54 = 0x1.0p54; // 1.80143985094819840000e+16; | |||
private static double ivln10 = 0x1.bcb7b1526e50ep-2; // 4.34294481903251816668e-01 | |||
|
|||
private static double log10_2hi = 0x1.34413509f6p-2; // 3.01029995663611771306e-01; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are this constants intentionally not final
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, just an oversight; I'll correct that. Thanks.
+ failures + " failures."); | ||
throw new RuntimeException(); | ||
// ... and just below subnormal threshold ... | ||
x = Math.nextDown(Double.MIN_NORMAL); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
x = Math.nextDown(Double.MIN_NORMAL); | |
x = Math.nextDown(Double.MIN_NORMAL); |
For consistency with the code for log10, the hex Otherwise LGTM |
PS To provide more context for the review, below are the "diff -w" output for the original C fdlibm with the transliteration port and the transliteration port with the more idiomatic port.
The constants are reformatted as expected and the __HI() C macro used on the left-hand side of an assignment is replaced by a Java method call. And port-vs-port:
|
|
||
-0x1.0p-54, | ||
0x1.0p-54, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add a comment like
/* approximations around sqrt(2)/2 - 1 and around sqrt(2) - 1 */
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I mean, for the doubles starting at L.246)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add a comment like
/* approximations around sqrt(2)/2 - 1 and around sqrt(2) - 1 */
Good clarification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No problems apparent to me: Reviewed.
@jddarcy This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 70 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
/integrate |
Going to push as commit ee0f5b5.
Your commit was automatically rebased without conflicts. |
Another day, another PR to port FDLBIM to Java, this time for the log1p method.
Other than using the two-argument form of the __HI method in Java transliteration version rather than C macro, there are no appreciable differences between the original C source in
src/java.base/share/native/libfdlibm/s_log1p.c
and the transliteration for testing purposes in
test/jdk/java/lang/StrictMath/FdlibmTranslit.java
The more idiomatic port in
src/java.base/share/classes/java/lang/FdLibm.java
has had a series of transformation applied layering on the transliteration. The intermediate commits show the progress.
The regression tests include probing around input values the implementation uses to decided which branch to take.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/12301/head:pull/12301
$ git checkout pull/12301
Update a local copy of the PR:
$ git checkout pull/12301
$ git pull https://git.openjdk.org/jdk pull/12301/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 12301
View PR using the GUI difftool:
$ git pr show -t 12301
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/12301.diff