Skip to content
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

feat: add math/base/special/kernel-log1p #2144

Merged
merged 13 commits into from
Apr 14, 2024
Merged

feat: add math/base/special/kernel-log1p #2144

merged 13 commits into from
Apr 14, 2024

Conversation

gunjjoshi
Copy link
Member

@gunjjoshi gunjjoshi commented Apr 8, 2024

Description

What is the purpose of this pull request?

This pull request:

  • adds math/base/special/kernel-log1p.

Related Issues

Does this pull request have any related issues?

None.

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request? This may include screenshots, references, and/or implementation notes.

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.


@stdlib-js/reviewers

@stdlib-bot stdlib-bot added the Math Issue or pull request specific to math functionality. label Apr 8, 2024
@gunjjoshi
Copy link
Member Author

gunjjoshi commented Apr 8, 2024

Code coverage report:

Screenshot 2024-04-08 at 23 50 23 Screenshot 2024-04-08 at 23 54 36

For the code coverage report, we are not able to get inside the branch when x = 0.0. This is because, when x = 0.0, in the parent kernelLog function, that means f = 0.0, which means the execution will go into L90 of main.js, rather than reaching below for the polyeval functions.

Copy link
Member

@kgryte kgryte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not being able to reach inside the polynomial functions is fine. We could write tests specifically for the polyval modules, but that seems like overkill for now.

@kgryte kgryte changed the title feat: add math/base/special/kernel-log feat: add math/base/special/kernel-log1p Apr 14, 2024
@kgryte
Copy link
Member

kgryte commented Apr 14, 2024

@gunjjoshi Okay. I've updated this PR. Note that I've done so based on msun v12.2.0. We should go ahead and update log2 and log10 accordingly based on 12.2.0, as well. Given that msun renamed this kernel function from log to log1p, we should follow suit.

It's still misleadingly misnamed IMO, and, in contrast to things like kernel-sin, this package is more of a helper function which only makes sense based on the implementations of log2 and log10. It's unlikely to be more generally useful. Nevertheless, I'm still fine with adding, as it reduces code duplication for log2 and log10.

As mentioned in my comment above, hard to test this function against reference implementations as doesn't really make sense on its own. So, I've effectively introduced smoke tests to ensure no accidental changes leading to regressions.

At this point, I think this is ready, but you should give it another look through to ensure that I haven't missed anything. If all looks good to you, I'll go ahead and merge. And once merged, if you want to take on refactoring log2 and log10, that would be great!

@gunjjoshi
Copy link
Member Author

@gunjjoshi Okay. I've updated this PR. Note that I've done so based on msun v12.2.0. We should go ahead and update log2 and log10 accordingly based on 12.2.0, as well. Given that msun renamed this kernel function from log to log1p, we should follow suit.

It's still misleadingly misnamed IMO, and, in contrast to things like kernel-sin, this package is more of a helper function which only makes sense based on the implementations of log2 and log10. It's unlikely to be more generally useful. Nevertheless, I'm still fine with adding, as it reduces code duplication for log2 and log10.

As mentioned in my comment above, hard to test this function against reference implementations as doesn't really make sense on its own. So, I've effectively introduced smoke tests to ensure no accidental changes leading to regressions.

At this point, I think this is ready, but you should give it another look through to ensure that I haven't missed anything. If all looks good to you, I'll go ahead and merge. And once merged, if you want to take on refactoring log2 and log10, that would be great!

Thanks for looking into this @kgryte. I tried to go through all the changes thoroughly, everything seems fine.
Once this gets merged, I will be refactoring log2 and log10. We can then just import kernel-log1p into both of these packages and directly use them, rather than having the older implementations in them as we have now.

@kgryte
Copy link
Member

kgryte commented Apr 14, 2024

@gunjjoshi Thanks for reviewing. I'll merge once CI finishes.

@kgryte kgryte merged commit dc2cd24 into stdlib-js:develop Apr 14, 2024
8 checks passed
@gunjjoshi gunjjoshi deleted the kernel-log branch April 15, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Math Issue or pull request specific to math functionality.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants