Backed out 3 changesets (bug 1892041) for causing failures on async-module-does-not...
[gecko.git] / js / src / tests / test262 / built-ins / Number / prototype / toFixed / exactness.js
blobb9e3bebc302ff97797c4f34c0b95244fe7657116
1 // Copyright (C) 2017 the V8 project authors. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
4 /*---
5 esid: sec-number.prototype.tofixed
6 description: Number.prototype.toFixed does not use ToString's cleaner rounding
7 info: |
8   Number.prototype.toFixed ( fractionDigits )
10   ...
11   8. Else x < 10^21,
12     a. Let n be an integer for which the exact mathematical value of n รท 10f - x is as close to zero as possible. If there are two such n, pick the larger n.
13     b. If n = 0, let m be the String "0". Otherwise, let m be the String consisting of the digits of the decimal representation of n (in order, with no leading zeroes).
14   ...
15 ---*/
17 // Test from a note in the specification
18 assert.sameValue((1000000000000000128).toString(), "1000000000000000100");
19 assert.sameValue((1000000000000000128).toFixed(0), "1000000000000000128");
21 reportCompare(0, 0);