Open bednarp opened 5 years ago
Same issue here, the following simple test doesn't pass:
import IntlPolyfill from 'intl'
Intl.DateTimeFormat = IntlPolyfill.DateTimeFormat;
Intl.NumberFormat = IntlPolyfill.NumberFormat;
it('formatNumber should not add digits', () => {
const value = 2.3492
const formatted = (new Intl.NumberFormat('en', {maximumFractionDigits: 20})).format(value)
expect(formatted).toEqual('2.3492')
});
Expected value to equal:
"2.3492"
Received:
"2.34920000000000032768"
This seems to be an issue with this library, as the same code run in the browser's console behaves as expected.
We are using Intl for unit testing in node environment. We encountered strange behaviour in our tests just in this particular case.
Expected output: "145,678.12345679" Received output: "145,678.12345679087"
we setup intl as follows: