Skip to content

significantDigits

Subhajit Sahu edited this page Aug 9, 2022 · 3 revisions

Count the number of significant digits in a number.


function significantDigits(x)
// x: a number

const xnumber = require('extra-number');


xnumber.significantDigits(0.0034);
// → 2

xnumber.significantDigits(120.5e50);
// → 4

xnumber.significantDigits(120.5e-50);
// → 4


References

Clone this wiki locally