Skip to content

[RFC]: add JS implementation for sign #2856

Closed
@Pranavchiku

Description

@Pranavchiku

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:.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BaseIssue or pull requests related to "low-level" functionality oriented toward library consumers.CIssue involves or relates to C.FeatureIssue or pull request for adding a new feature.JavaScriptIssue involves or relates to JavaScript.MathIssue or pull request specific to math functionality.Native AddonsIssue involves or relates to Node.js native add-ons.difficulty: 1Low degree of difficulty. Should be straightforward to implement and/or resolve.priority: HighHigh priority concern or feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions