JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 20939
  • Score
    100M100P100Q11588F
  • License MIT

Counts the number of significant digits of a number.

Package Exports

  • @extra-number/significant-digits

Readme

Counts the number of significant digits of a number.

Based on the solution provided by @Jos de Jong.
This is part of package extra-number.

number.significantDigits(n);
// n: a number
const number = require('extra-number');

number.significantDigits(0.0034);
// 2

number.significantDigits(120.5e50);
// 4

number.significantDigits(120.5e-50);
// 4

references