Skip to content

Conversation

Neerajpathak07
Copy link
Member

@Neerajpathak07 Neerajpathak07 commented Mar 2, 2025

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
@stdlib-bot
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!

@Neerajpathak07
Copy link
Member Author

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

@Neerajpathak07
Copy link
Member Author

Neerajpathak07 commented Mar 5, 2025

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.

@Neerajpathak07
Copy link
Member Author

Neerajpathak07 commented Mar 6, 2025

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.

@gunjjoshi
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
@anandkaranubc
Copy link
Contributor

/stdlib merge

@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
@stdlib-bot
Copy link
Contributor

stdlib-bot commented Aug 26, 2025

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! 🚀

@Neerajpathak07
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

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.

@Planeshifter Planeshifter requested a review from gunjjoshi August 28, 2025 00:11
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. 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
Development

Successfully merging this pull request may close these issues.

6 participants