-
-
Notifications
You must be signed in to change notification settings - Fork 844
feat: add lapack/base/dlapy2
#2845
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
Conversation
if ( isnan( x ) || isnan( y ) ) { | ||
return NaN; | ||
} | ||
hugeval = dlamch( 'O' ); |
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.
@Pranavchiku Isn't this a value a constant and can be elevated to the parent scope? I don't believe we need to call dlamch
for each invocation.
```javascript | ||
var randu = require( '@stdlib/random/base/randu' ); | ||
var round = require( '@stdlib/math/base/special/round' ); | ||
|
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.
@Pranavchiku You are missing a require
statement here.
* var v = dlapy2( -5.0, 12.0 ); | ||
* // returns 13.0 | ||
*/ | ||
function dlapy2( x, y ) { |
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 implementation is effectively hypot
. As such, I'd just have dlapy2
wrap that function. No need to reinvent the wheel.
if ( z === 0.0 || w > hugeval ) { | ||
return w; | ||
} | ||
return w * sqrt( 1.0 + pow( ( z / w ), 2 ) ); |
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.
No need to use pow
BTW. You can use abs2
which is much lighter weight.
Thank you for working on this pull request. However, we cannot accept your contribution as the issue this pull request seeks to resolve has already been addressed in a different pull request or commit. Thank you again for your interest in stdlib, and we look forward to reviewing your future contributions. |
Towards #2464.
Description
This pull request adds JS implementation for
lapack/base/dlapy2
.Related Issues
NA
Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers