Socket
Socket
Sign inDemoInstall

nextafter

Package Overview
Dependencies
1
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nextafter

Find the floating point number immediately after any given number


Version published
Weekly downloads
52K
increased by24.22%
Maintainers
1
Install size
14.8 kB
Created
Weekly downloads
 

Readme

Source

nextafter

Returns the next floating point number after any given number in the direction of some other floating point number. (Like the C standard library function).

testling badge

build status

Example

var nextafter = require("nextafter")

var x = 0.1
console.log("The number", x, "is between", nextafter(x, -Infinity), "and", nextafter(x, Infinity))

Output:

The number 0.1 is between 0.09999999999999999 and 0.10000000000000002

Install

npm install nextafter

API

require("nextafter")(from, to)

Returns the floating point number closest to from in the direction on of to

  • If from === to, then returns from
  • If from < to, then returns next representable float after from
  • If from > to, then returns the floating point nubmer immediately before from

Credits

(c) 2014 Mikola Lysenko. MIT License

Keywords

FAQs

Last updated on 12 Jun 2014

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc