Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add math/base/special/powf #5739

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

Open
Neerajpathak07 wants to merge 17 commits into stdlib-js:develop
base: develop
Choose a base branch
Loading
from Neerajpathak07:add-powf

Conversation

Copy link
Member

@Neerajpathak07 Neerajpathak07 commented Mar 2, 2025
edited by gunjjoshi
Loading

Progresses #649.

Description

What is the purpose of this pull request?

This pull request:

  • adds math/base/special/powf which is the single-precision version of pow

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

@stdlib-bot stdlib-bot added the Math Issue or pull request specific to math functionality. label Mar 2, 2025
Copy link
Contributor

Hello! 👋

I've noticed that your commit doesn't contain the expected YAML metadata blocks. This typically happens when your development environment isn't properly set up with the stdlib git hooks.

Here's how to fix this:

  1. Install project dependencies (run this command in the top-level directory of the project):

    make install
  2. Initialize the development environment (this sets up the Git hooks among other things):

    make init

If you're still having issues, please check our development guide for more information.

Thank you for your contribution!

Copy link
Member Author

@kgryte @gunjjoshi what do you guys think of the JS implementation so far!!

Copy link
Member Author

Neerajpathak07 commented Mar 5, 2025
edited
Loading

Updates so far cc: @kgryte @gunjjoshi

  • Went through the binary format for float32 as discussed in the meet and referred documentation for to-uint32, from-binary-string & to-binary-string also studied the documentation for constants/float32 packages.
  • Changed var names across logx logax and pow2 with accurate hexadecimal values based on upstream implementation with corresponding logical var names.
  • Based all the JS implementation wrt to powf
  • used JS var like towordf and forWordf to resonate with GET_FLOAT_WORD & SET_FLOAT_WORD.
  • reduced the LOG_WORKSPACE from an array of high and low bits to a singular var to compensate 32-bit int!!
  • wrapped the implementation in float64ToFloat32
  • reduced CI errors now most of them require C implementation of powf
  • updated reference link in JS licenses to the msun file for powf
  • removed the logic for high and low words space and added logic for single variable workspace in main.js

Upcoming updates

  • adding test fixtures.
  • Working on test cases.
  • adding C implementations once the JS one is approved.
  • Fixing bugs and typo errors.

Copy link
Member Author

Neerajpathak07 commented Mar 6, 2025
edited
Loading

Had to rebase a branch as an unwanted change was added Ik it's unethical to do this but it was messing the purpose of this big-PR everything is running clean now working on more features.

Copy link
Member

@Neerajpathak07 Let's follow https://svnweb.freebsd.org/base/release/12.2.0/lib/msun/src/e_powf.c?revision=367086&view=markup here. The current implementation in main.js looks a bit off from this reference. You might want to restructure it, so that it matches with the reference.

@stdlib-bot stdlib-bot added the Needs Review A pull request which needs code review. label Aug 16, 2025
Copy link
Contributor

/stdlib merge

stdlib-bot reacted with eyes emoji

@stdlib-bot stdlib-bot added the bot: In Progress Pull request is currently awaiting automation. label Aug 18, 2025
@stdlib-bot stdlib-bot removed the bot: In Progress Pull request is currently awaiting automation. label Aug 18, 2025
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
 - task: lint_filenames
 status: passed
 - task: lint_editorconfig
 status: passed
 - task: lint_markdown
 status: na
 - task: lint_package_json
 status: na
 - task: lint_repl_help
 status: na
 - task: lint_javascript_src
 status: passed
 - task: lint_javascript_cli
 status: na
 - task: lint_javascript_examples
 status: na
 - task: lint_javascript_tests
 status: passed
 - task: lint_javascript_benchmarks
 status: na
 - task: lint_python
 status: na
 - task: lint_r
 status: na
 - task: lint_c_src
 status: passed
 - task: lint_c_examples
 status: na
 - task: lint_c_benchmarks
 status: na
 - task: lint_c_tests_fixtures
 status: na
 - task: lint_shell
 status: na
 - task: lint_typescript_declarations
 status: na
 - task: lint_typescript_tests
 status: na
 - task: lint_license_headers
 status: passed
---
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
 - task: lint_filenames
 status: passed
 - task: lint_editorconfig
 status: passed
 - task: lint_markdown
 status: na
 - task: lint_package_json
 status: na
 - task: lint_repl_help
 status: na
 - task: lint_javascript_src
 status: passed
 - task: lint_javascript_cli
 status: na
 - task: lint_javascript_examples
 status: na
 - task: lint_javascript_tests
 status: passed
 - task: lint_javascript_benchmarks
 status: na
 - task: lint_python
 status: na
 - task: lint_r
 status: na
 - task: lint_c_src
 status: passed
 - task: lint_c_examples
 status: na
 - task: lint_c_benchmarks
 status: na
 - task: lint_c_tests_fixtures
 status: na
 - task: lint_shell
 status: na
 - task: lint_typescript_declarations
 status: na
 - task: lint_typescript_tests
 status: na
 - task: lint_license_headers
 status: passed
---
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
 - task: lint_filenames
 status: passed
 - task: lint_editorconfig
 status: passed
 - task: lint_markdown
 status: na
 - task: lint_package_json
 status: na
 - task: lint_repl_help
 status: na
 - task: lint_javascript_src
 status: passed
 - task: lint_javascript_cli
 status: na
 - task: lint_javascript_examples
 status: na
 - task: lint_javascript_tests
 status: na
 - task: lint_javascript_benchmarks
 status: na
 - task: lint_python
 status: na
 - task: lint_r
 status: na
 - task: lint_c_src
 status: na
 - task: lint_c_examples
 status: na
 - task: lint_c_benchmarks
 status: na
 - task: lint_c_tests_fixtures
 status: na
 - task: lint_shell
 status: na
 - task: lint_typescript_declarations
 status: na
 - task: lint_typescript_tests
 status: na
 - task: lint_license_headers
 status: passed
---
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
 - task: lint_filenames
 status: passed
 - task: lint_editorconfig
 status: passed
 - task: lint_markdown
 status: passed
 - task: lint_package_json
 status: passed
 - task: lint_repl_help
 status: na
 - task: lint_javascript_src
 status: na
 - task: lint_javascript_cli
 status: na
 - task: lint_javascript_examples
 status: passed
 - task: lint_javascript_tests
 status: na
 - task: lint_javascript_benchmarks
 status: passed
 - task: lint_python
 status: na
 - task: lint_r
 status: na
 - task: lint_c_src
 status: passed
 - task: lint_c_examples
 status: passed
 - task: lint_c_benchmarks
 status: passed
 - task: lint_c_tests_fixtures
 status: na
 - task: lint_shell
 status: na
 - task: lint_typescript_declarations
 status: passed
 - task: lint_typescript_tests
 status: na
 - task: lint_license_headers
 status: passed
---
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
 - task: lint_filenames
 status: passed
 - task: lint_editorconfig
 status: passed
 - task: lint_markdown
 status: na
 - task: lint_package_json
 status: na
 - task: lint_repl_help
 status: na
 - task: lint_javascript_src
 status: na
 - task: lint_javascript_cli
 status: na
 - task: lint_javascript_examples
 status: na
 - task: lint_javascript_tests
 status: na
 - task: lint_javascript_benchmarks
 status: na
 - task: lint_python
 status: na
 - task: lint_r
 status: na
 - task: lint_c_src
 status: na
 - task: lint_c_examples
 status: passed
 - task: lint_c_benchmarks
 status: na
 - task: lint_c_tests_fixtures
 status: na
 - task: lint_shell
 status: na
 - task: lint_typescript_declarations
 status: passed
 - task: lint_typescript_tests
 status: na
 - task: lint_license_headers
 status: passed
---
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
 - task: lint_filenames
 status: passed
 - task: lint_editorconfig
 status: passed
 - task: lint_markdown
 status: na
 - task: lint_package_json
 status: na
 - task: lint_repl_help
 status: na
 - task: lint_javascript_src
 status: passed
 - task: lint_javascript_cli
 status: na
 - task: lint_javascript_examples
 status: na
 - task: lint_javascript_tests
 status: passed
 - task: lint_javascript_benchmarks
 status: na
 - task: lint_python
 status: na
 - task: lint_r
 status: na
 - task: lint_c_src
 status: passed
 - task: lint_c_examples
 status: na
 - task: lint_c_benchmarks
 status: na
 - task: lint_c_tests_fixtures
 status: na
 - task: lint_shell
 status: na
 - task: lint_typescript_declarations
 status: na
 - task: lint_typescript_tests
 status: na
 - task: lint_license_headers
 status: passed
---
@anandkaranubc anandkaranubc marked this pull request as ready for review August 26, 2025 05:43
Copy link
Contributor

stdlib-bot commented Aug 26, 2025
edited
Loading

Coverage Report

Package Statements Branches Functions Lines
math/base/special/powf $\color{red}1219/1253$
$\color{green}+97.29\%$
$\color{red}100/103$
$\color{green}+97.09\%$
$\color{red}8/10$
$\color{green}+80.00\%$
$\color{red}1219/1253$
$\color{green}+97.29\%$

The above coverage report was generated for the changes in this PR.

@anandkaranubc anandkaranubc added Feature Issue or pull request for adding a new feature. JavaScript Issue involves or relates to JavaScript. C Issue involves or relates to C. labels Aug 26, 2025
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
 - task: lint_filenames
 status: passed
 - task: lint_editorconfig
 status: passed
 - task: lint_markdown
 status: na
 - task: lint_package_json
 status: passed
 - task: lint_repl_help
 status: na
 - task: lint_javascript_src
 status: na
 - task: lint_javascript_cli
 status: na
 - task: lint_javascript_examples
 status: na
 - task: lint_javascript_tests
 status: na
 - task: lint_javascript_benchmarks
 status: na
 - task: lint_python
 status: na
 - task: lint_r
 status: na
 - task: lint_c_src
 status: na
 - task: lint_c_examples
 status: na
 - task: lint_c_benchmarks
 status: na
 - task: lint_c_tests_fixtures
 status: na
 - task: lint_shell
 status: na
 - task: lint_typescript_declarations
 status: na
 - task: lint_typescript_tests
 status: na
 - task: lint_license_headers
 status: passed
---
Copy link
Contributor

@anandkaranubc anandkaranubc left a comment

Choose a reason for hiding this comment

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

Thanks @Neerajpathak07 for your contribution! This will indeed be a great addition! 🚀

Copy link
Member Author

@anandkaranubc Thanks for your continuous efforts to get this one over the finish line.

Copy link
Member

@Planeshifter Planeshifter left a comment
edited
Loading

Choose a reason for hiding this comment

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

LGTM! Thank you @Neerajpathak07 and @anandkaranubc!

There are various discrepancies between the function parameter names in the implementation and public-facing docs, but I do no think we need to address these. They are also present in pow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@kgryte kgryte kgryte left review comments

@Planeshifter Planeshifter Planeshifter approved these changes

@anandkaranubc anandkaranubc anandkaranubc approved these changes

@gunjjoshi gunjjoshi Awaiting requested review from gunjjoshi

Requested changes must be addressed to merge this pull request.

Assignees
No one assigned
Labels
C Issue involves or relates to C. Feature Issue or pull request for adding a new feature. JavaScript Issue involves or relates to JavaScript. Math Issue or pull request specific to math functionality. Needs Review A pull request which needs code review.
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /