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/sqrtpif #3116

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

gururaj1512
Copy link
Contributor

@gururaj1512 gururaj1512 commented Nov 15, 2024

Resolves a part of #649 .

Description

What is the purpose of this pull request?

Adds package math/base/special/sqrtpif

This pull request:

Related Issues

Does this pull request have any related issues?

  • Test cases are failing due to values unaccurate more than tolerance.

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 Nov 15, 2024
@gururaj1512
Copy link
Contributor Author

@gunjjoshi, The test cases are failing for this package. Can you review main.js and point out if something is wrong.


var sqrtf = require( '@stdlib/math/base/special/sqrtf' );
var PI = require( '@stdlib/constants/float32/pi' );

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' );

* // returns NaN
*/
function sqrtpif( x ) {
return sqrtf( x * PI );
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return sqrtf( x * PI );
return sqrtf( float64ToFloat32( float64ToFloat32( x ) * PI ) );

Copy link
Member

Choose a reason for hiding this comment

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

You should use float64ToFloat32 to wrap the input values and arithmetic operations, when dealing with single-precision calculations.

Copy link
Member

Choose a reason for hiding this comment

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

@kgryte kgryte added Feature Issue or pull request for adding a new feature. Needs Review A pull request which needs code review. labels Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Issue or pull request for adding a new feature. 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.

4 participants