1.1.1 • Published 8 years ago

scientific-to-decimal v1.1.1

Weekly downloads
101
License
MIT
Repository
github
Last release
8 years ago

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.