Skip to content
Subhajit Sahu edited this page Aug 9, 2022 · 1 revision

Check if bigint is a power-of-2.

Similar: isPow2, isPow10.
Similar: isPow2, prevPow2, nextPow2.


function isPow2(x)
// x: a bigint

const xbigint = require('extra-bigint');


xbigint.isPow2(32n);
// → true

xbigint.isPow2(1023n);
// → false


References

Clone this wiki locally