-
-
Notifications
You must be signed in to change notification settings - Fork 489
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
base: develop
Are you sure you want to change the base?
Conversation
@gunjjoshi, The test cases are failing for this package. Can you review |
|
||
var sqrtf = require( '@stdlib/math/base/special/sqrtf' ); | ||
var PI = require( '@stdlib/constants/float32/pi' ); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
var float64ToFloat32 = require( '@stdlib/number/float64/base/to-float32' ); | |
* // returns NaN | ||
*/ | ||
function sqrtpif( x ) { | ||
return sqrtf( x * PI ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return sqrtf( x * PI ); | |
return sqrtf( float64ToFloat32( float64ToFloat32( x ) * PI ) ); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is similar to what we follow in math/base/special/sqrtf
: https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/math/base/special/sqrtf/lib/main.js
Resolves a part of #649 .
Description
Adds package
math/base/special/sqrtpif
This pull request:
Related Issues
Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers