signum
Returns the sign of a number
Last updated 13 years ago by mikolalysenko .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install signum 
SYNC missed versions from official npm registry.

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

Current Tags

  • 1.0.0                                ...           latest (13 years ago)

2 Versions

  • 1.0.0                                ...           13 years ago
  • 0.0.0                                ...           13 years ago
Maintainers (1)
Downloads
Total 7
Today 0
This Week 0
This Month 2
Last Day 0
Last Week 0
Last Month 2
Dependencies (0)
None
Dev Dependencies (1)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE