Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

next-power-of-two

1.0.0 • Public • Published

next-power-of-two

frozen

For a positive number, returns the next highest power of two.

var nextPOT = require('next-power-of-two')
 
nextPOT(100) === 128
nextPOT(50)  === 64
nextPOT(8)   === 8

Usage

NPM

nextPowerOfTwo(number)

For the positive number, returns the next highest power of two value. If number is a power of two, it will be returned.

If number is zero, 1 is returned. Negative numbers produce undefined results.

See Also

License

MIT, see LICENSE.md for details.

Install

npm i next-power-of-two

DownloadsWeekly Downloads

1,165

Version

1.0.0

License

MIT

Last publish

Collaborators

  • avatar