scientific-to-decimal
v1.1.1
Published
A function which will convert scientific numbers to decimal strings
Downloads
1,110
Maintainers
Readme
scientific-to-decimal
A function which will convert scientific numbers to decimal strings.
Usage
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.