Decimal proposal polyfill

I’m hap­py to an­nounce that the dec­i­mal pro­pos­al—a pro­posed ex­ten­sion of JavaScript to sup­port dec­i­mal num­bers—is now avail­able as an NPM pack­age called proposal-decimal!

(Ac­tu­al­ly, it has been avail­able for some time, made avail­able not long af­ter we de­cid­ed to pur­sue IEEE 754 Dec­i­mal128 as a data mod­el for the dec­i­mal pro­pos­al rather than some al­ter­na­tives. The old pack­age was—and still is—avail­able un­der a dif­fer­ent name—decimal128—but I’ll be sun­set­ting that pack­age in fa­vor of the new one an­nounced here. If you’ve been us­ing dec­i­mal128, you can con­tin­ue to use it, but you’ll prob­a­bly want to switch to proposal-decimal.)

To use proposal-decimal in your project, in­stall the NPM pack­age. If you’re look­ing to use this code in Node.js or oth­er JS en­gines that sup­port ESM, you'll want to im­port the code like this:

import { Decimal128
``` from 'proposal-decimal';
const x = new Decimal128("0.1");
// etc.


For use in a browser, the file `dist/Decimal128.mjs` contains the `Decimal128` class and all its internal dependencies in a single file. Use it like this:

```html
<script type="module">
import { Decimal128
``` from 'path/to/Decimal128.mjs';
const x = new Decimal128("0.1");
// keep rocking decimals!
</script>


The intention of this polyfill is to **track the spec text** for the decimal proposal. I cannot recommend this package for production use just yet, but it is usable and I’d love to hear any experience reports you may have. We’re aiming to be as faithful as possible to the spec, so we don’t aim to be blazingly fast. That said, please do report any wild deviations in performance compared to other decimal libraries for JS as an [issue](https://github.com/jessealama/proposal-decimal-polyfill/issues "Issues for proposal-decimal-polyfill (GitHub)"). Any crashes or incorrect results should likewise be reported as an issue.


*Enjoy!*