scientific-to-decimal

A function which will convert scientific numbers to decimal strings

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
scientific-to-decimal
921.1.18 years ago8 years agoMinified + gzip package size for scientific-to-decimal in KB

Readme

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.