1.0.0 • Published 3 years ago
round-powers v1.0.0
round-powers
Round a number to the closest power.
Install
npm install round-powers
Usage
const roundPowers = require("round-powers")
roundPowers(10, 2)
//=> 8
roundPowers.up(10, 2)
//=> 16
roundPowers.down(10, 2)
//=> 8
API
roundPowers(number, base)
Round number
to the nearest power of base
.
roundPowers.up(number, base)
Round number
up to the nearest power of base
.
roundPowers.down(number, base)
Round number
down to the nearest power of base
.
number
Type: number
The number to round.
base
Type: number
The base number to find the nearest power of.
1.0.0
3 years ago