signum

1.0.0 • Public • Published

signum

Returns the sign of a floating point number

Example

var sgn = require("signum")
 
console.log(sgn(-0.00001))
console.log(sng(0))
console.log(sng(Infinity))

Output:

-1
0
1

Install

npm install signum

API

require("signum")(x)

Returns the sign of x

  • x is a number

Returns One of the following values

  • -1 if x<0
  • 1 if x>0
  • 0 otherwise

Credits

(c) 2014 Mikola Lysenko. MIT License

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.0
    225,985
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.0
    225,985
  • 0.0.0
    83,848

Package Sidebar

Install

npm i signum

Weekly Downloads

309,833

Version

1.0.0

License

MIT

Last publish

Collaborators

  • mikolalysenko