scientific-to-decimal

1.1.1 • Public • Published

scientific-to-decimal

experimental

A function which will convert scientific numbers to decimal strings.

Usage

NPM

Example

scientificToDecimal(1e+32); // '100000000000000000000000000000000'
scientificToDecimal(4.345e+21); // '4345000000000000000000'
scientificToDecimal(1e-9); // '0.000000001')
scientificToDecimal(4.34e-14); // '0.0000000000000434'
 
// optionally you can pass in a second value for digits to set to a
// specific precision
scientificToDecimal(4.34e-14, 14); // '0.00000000000004'
scientificToDecimal(4.34e-14, 10); // '0'
 
// will handle other numbers also
scientificToDecimal(33); // '33'
scientificToDecimal(NaN); // 'NaN'

License

MIT, see LICENSE.md for details.

Package Sidebar

Install

npm i scientific-to-decimal

Weekly Downloads

309

Version

1.1.1

License

MIT

Last publish

Collaborators

  • mikkoh