chakra-core / chakra-core/ChakraCore
Number.prototype.toFixed() against big numbers doesn't have enough precision.
- Dominant language
- JavaScript
- Stars
- 9.3k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
I'm using Microsoft Edge 42.17134.1.0.
I noticed some bug in `Number.prototype.toFixed()`. For example, following code shows unexpected result on Microsoft Edge.
```javascript
x = 1125899906842623.9;
console.log(x.toFixed(2)); // Edge: 1125899906842623.90, Chrome: 1125899906842623.88
```
Microsoft Edge (and also IE 11) returns `"1125899906842623.90"`. However, Chrome and other browsers return `"1125899906842623.88"`.
ECMAScript specification requires that `Number.prototype.toFixed()` must return mathematically closest decimal expression to `x`. The exact value of `x` is `1125899906842623.875`, so the correct return value seems to be `"1125899906842623.88"`.
Contributor guide
Assessment
This issue has not been assessed yet.