Round a number to the closest power.
npm install round-powers
const roundPowers = require("round-powers")
roundPowers(10, 2)
//=> 8
roundPowers.up(10, 2)
//=> 16
roundPowers.down(10, 2)
//=> 8
Round number
to the nearest power of base
.
Round number
up to the nearest power of base
.
Round number
down to the nearest power of base
.
Type: number
The number to round.
Type: number
The base number to find the nearest power of.