Number.prototype.toExponential 


An ES-spec-compliant Number.prototype.toExponential shim/polyfill/replacement that works as far down as ES3
This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec.
Where this is needed
In particular:
- Edge 15-17, and the equivalent versions of ChakraCore, have a rounding bug
- IE <= 11, and Edge <= 14, have a different rounding bug
- IE 6-8 do not properly throw on ±Infinity as fractionalDigits
- FF 3.6-86 have a rounding bug
- Safari < 11 and FF < 50 incorrectly throw on edge cases
If you are not concerned with supporting these engines, there is no need to use this package.
Note: ES2018 increased the maximum range from 20 to 100. This package does not attempt to patch this difference.
Getting started
npm install --save number.prototype.exponential
Usage/Examples
console.log((-3).toExponential());
console.log(0x10.toExponential(2));
console.log(1.23456.toExponential(5));
console.log((-6.9e-11).toExponential(4));
Tests
Clone the repo, npm install, and run npm test