Skip to content

Commit f14945b

Browse files
committed
Add V8 Math.round bug
1 parent 45a1830 commit f14945b

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

docs/native_math_bugs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
* [Mozilla `Math.pow` issue][@bug:mozilla:1316557]
3737
* [V8 deoptimizes if `Math.floor` provided `-0`][@bug:v8:2890]
3838
* [V8 deoptimizes if `Math.ceil` provided `0`][@bug:v8:4059]
39+
* [V8 `Math.round` accuracy][@bug:v8:958]
3940

4041

41-
* [Accuracy of `Math.round` in V8][21]
4242
* [Observability of distinguishable NaNs][22]
4343
* [SpiderMonkey updates `Math.random`][23]
4444
* [V8 blog on xoshirt implementation][24]
@@ -94,14 +94,14 @@
9494
[@bug:mozilla:1316557]: https://bugzilla.mozilla.org/show_bug.cgi?id=1316557
9595
[@bug:v8:2890]: https://bugs.chromium.org/p/v8/issues/detail?id=2890
9696
[@bug:v8:4059]: https://bugs.chromium.org/p/v8/issues/detail?id=4059
97+
[@bug:v8:958]: https://bugs.chromium.org/p/v8/issues/detail?id=958
9798

9899

99100
[v8-issue-tracker]: https://bugs.chromium.org/p/v8/issues/list?can=1&q=math&colspec=ID%20Type%20Status%20Priority%20Owner%20Summary%20HW%20OS%20Component%20Stars&num=100&start=100
100101
[webkit-issue-tracker]: https://bugs.webkit.org/buglist.cgi?quicksearch=math
101102
[mozilla-issue-tracker]: https://bugzilla.mozilla.org/buglist.cgi?quicksearch=math
102103

103104

104-
[21]: https://bugs.chromium.org/p/v8/issues/detail?id=958
105105
[22]: https://esdiscuss.org/topic/observability-of-nan-distinctions-is-this-a-concern
106106
[23]: https://bugzilla.mozilla.org/show_bug.cgi?id=322529#c99
107107
[25]: https://bugs.webkit.org/show_bug.cgi?id=151641

docs/references/bugs.bib

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,12 @@ @misc{bug:v8:4059
281281
year = {2015}
282282
}
283283

284+
@misc{bug:v8:958,
285+
abstract = {Math.round(x) is implemented as Math.floor(x + 0.5). This looses precision in some cases. var s = 0.49999999999999994; alert([s, s + 0.5, Math.round(s)]); // Alerts "0.49999999999999994,5,5", i.e., incorrectly rounds to 5, not 4.},
286+
keywords = {math, javascript, v8, chrome, round},
287+
notes = {},
288+
title = {{Math.round rounds incorrectly.}},
289+
url = {https://bugs.chromium.org/p/v8/issues/detail?id=958},
290+
year = {2010}
291+
}
292+

0 commit comments

Comments
 (0)