Big News: Socket Selected for OpenAI's Cybersecurity Grant Program.Details
Socket
Book a DemoSign in
Socket

signum

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

signum

Returns the sign of a number

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
1M
2.45%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

sign

FAQs

Package last updated on 30 Apr 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts