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 C implementation for math/base/special/pow #1739

Merged
merged 18 commits into from
Jun 19, 2024

Conversation

aman-095
Copy link
Member

@aman-095 aman-095 commented Mar 6, 2024

Resolves #1656.

Description

What is the purpose of this pull request?

This RFC proposes adding native C implementation for @stdlib/math/base/special/pow

double stdlib_base_pow( const double b, const double x )

Related Issues

Does this pull request have any related issues?

This pull request:

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

@aman-095
Copy link
Member Author

aman-095 commented Mar 6, 2024

There is some minor error that is leading to test failure. Can you please check the implementation? CC @kgryte @Pranavchiku @Planeshifter

@kgryte kgryte added Feature Issue or pull request for adding a new feature. Math Issue or pull request specific to math functionality. Native Addons Issue involves or relates to Node.js native add-ons. C Issue involves or relates to C. labels Mar 7, 2024
@aman-095
Copy link
Member Author

aman-095 commented Mar 8, 2024

@kgryte @Pranavchiku all tests, examples, and benchmarks work well locally. Don't know why CI is failing. Please review.

@aman-095 aman-095 marked this pull request as ready for review March 8, 2024 10:01
@Planeshifter Planeshifter changed the title feat: Add C implementation for math/base/special/pow feat: add C implementation for math/base/special/pow Mar 8, 2024
aman-095 and others added 14 commits March 11, 2024 23:46
Signed-off-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
@aman-095
Copy link
Member Author

CC @kgryte @Pranavchiku all tests work well locally. Don't know why tests are failing here.

Copy link
Member

@Planeshifter Planeshifter left a comment

Choose a reason for hiding this comment

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

The discrepancy in test cases arise from floating-point operation fusing (see clang.llvm.org/docs/UsersManual.html#cmdoption-ffp-contract), where multiple floating-point operations are combined into a single operation.

See prior discussion here: #2298 (comment)

When compiling the add-on with this optimization disabled via

CFLAGS="-ffp-contract=off" NODE_GYP_FLAGS="" make install-node-addons NODE_ADDONS_PATTERN="math/base/special/pow"

all test cases match the results from the test fixtures.

@Planeshifter Planeshifter merged commit 4a0235a into stdlib-js:develop Jun 19, 2024
7 of 8 checks passed
@Pranavchiku
Copy link
Member

Woah! we finally got pow knocked out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C Issue involves or relates to C. Feature Issue or pull request for adding a new feature. Math Issue or pull request specific to math functionality. Native Addons Issue involves or relates to Node.js native add-ons. Needs Changes Pull request which needs changes before being merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[RFC]: Add C implementation for @stdlib/math/base/special/pow
4 participants