Skip to content

nextPow10

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

Find smallest power-of-10 greater than or equal to given bigint.

Similar: nextPow2, nextPow10.
Similar: isPow10, prevPow10, nextPow10.


function nextPow10(x)
// x: a bigint

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


xbigint.nextPow10(10n);
// → 10n

xbigint.nextPow10(999n);
// → 1000n


References

Clone this wiki locally