We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Find largest power-of-2 less than or equal to given bigint.
Similar: prevPow2, prevPow10. Similar: isPow2, prevPow2, nextPow2.
function prevPow2(x) // x: a bigint
const xbigint = require('extra-bigint'); xbigint.prevPow2(32n); // → 32n xbigint.prevPow2(1023n); // → 512n