Skip to content

prevPow10

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

Find largest power-of-10 less than or equal to given bigint.

Similar: prevPow2, prevPow10.
Similar: isPow10, prevPow10, nextPow10.


function prevPow10(x)
// x: a bigint

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


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

xbigint.prevPow10(999n);
// → 100n


References

Clone this wiki locally