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

[RFC]: add JS implementation for sign #2856

Closed
3 tasks done
Pranavchiku opened this issue Sep 2, 2024 · 2 comments
Closed
3 tasks done

[RFC]: add JS implementation for sign #2856

Pranavchiku opened this issue Sep 2, 2024 · 2 comments
Labels
Base Issue or pull requests related to "low-level" functionality oriented toward library consumers. C Issue involves or relates to C. difficulty: 1 Low degree of difficulty. Should be straightforward to implement and/or resolve. 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. Native Addons Issue involves or relates to Node.js native add-ons. priority: High High priority concern or feature request.

Comments

@Pranavchiku
Copy link
Member

Pranavchiku commented Sep 2, 2024

Description

This RFC proposes adding JS implementation equivalent to sign present in Fortran. This is used often in LAPACK/BLAS packages.

/**
* Returns `x` multipled by `signum( y )`.
*
* @param {number} x - scalar element
* @param {number} y - scalar element
* @returns {number} computed value
*
* @example
* var out = sign( 1.0, -0.9 );
* // out => -1.0
*/
function sign( x, y ) {
	return x * signum( y );
}

Where we already have implementation for signum

alias: @stdlib/math/base/special/sign
reference: @stdlib/math/base/special/max

Related Issues

Related issues #2464.

Questions

No.

Other

cc @kgryte

Checklist

  • I have read and understood the Code of Conduct.
  • Searched for existing issues and pull requests.
  • The issue name begins with RFC:.
@Pranavchiku Pranavchiku added Feature Issue or pull request for adding a new feature. difficulty: 1 Low degree of difficulty. Should be straightforward to implement and/or resolve. Math Issue or pull request specific to math functionality. Native Addons Issue involves or relates to Node.js native add-ons. Base Issue or pull requests related to "low-level" functionality oriented toward library consumers. priority: High High priority concern or feature request. JavaScript Issue involves or relates to JavaScript. C Issue involves or relates to C. labels Sep 2, 2024
@kgryte
Copy link
Member

kgryte commented Sep 2, 2024

@Pranavchiku How is this different from copysign?

@Pranavchiku
Copy link
Member Author

I missed it, sorry, closing it.

Note: Use copysign in #2819.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Base Issue or pull requests related to "low-level" functionality oriented toward library consumers. C Issue involves or relates to C. difficulty: 1 Low degree of difficulty. Should be straightforward to implement and/or resolve. 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. Native Addons Issue involves or relates to Node.js native add-ons. priority: High High priority concern or feature request.
Projects
None yet
Development

No branches or pull requests

2 participants