1.0.1 • Published 7 years ago

ulp v1.0.1

Weekly downloads
335
License
MIT
Repository
github
Last release
7 years ago

ulp

Build Status Coverage Status semantic-release Commitizen friendly

Math.nextDown, Math.nextUp, Math.ulp in javascript (from https://gist.github.com/Yaffle/4654250)

nextUp(x: number): number

Returns the smallest floating-point number greater than x. Denormalized values may not be supported.

var nextUp = require('ulp').nextUp
nextUp(1) // 1.0000000000000002

nextDown(x: number): number

Returns the largest floating-point number less than x. Denormalized values may not be supported.

var nextDown = require('ulp').nextDown
nextDown(1) // 0.9999999999999999

ulp(x: number): number

Returns the unit in the last place of x. Denormalized values may not be supported.

var ulp = require('ulp').ulp
ulp(1) // 1.1102230246251565e-16

monkeypatch(): void

Monkeypatches nextUp, nextDown, and ulp onto Math.

require('ulp').monkeypatch()
Math.nextUp(1) // 1.0000000000000002
Math.nextDown(1) // 0.9999999999999999
Math.ulp(1) // 1.1102230246251565e-16
1.0.1

7 years ago

1.0.0

7 years ago