Lines Matching refs:toFixed
25 'This test checks a few Number.toFixed cases, including ' +
26 '<a href="https://bugs.webkit.org/show_bug.cgi?id=5307">5307: Number.toFixed does not round 0.5 up</a>' +
28 '<a href="https://bugs.webkit.org/show_bug.cgi?id=5308">5308: Number.toFixed does not include leading zero</a>' +
31 shouldBe("(0).toFixed(0)", "'0'");
33 shouldBe("(0.49).toFixed(0)", "'0'");
34 shouldBe("(0.5).toFixed(0)", "'1'");
35 shouldBe("(0.51).toFixed(0)", "'1'");
37 shouldBe("(-0.49).toFixed(0)", "'-0'");
38 shouldBe("(-0.5).toFixed(0)", "'-1'");
39 shouldBe("(-0.51).toFixed(0)", "'-1'");
41 shouldBe("(0).toFixed(1)", "'0.0'");
43 shouldBe("(0.449).toFixed(1)", "'0.4'");
44 shouldBe("(0.45).toFixed(1)", "'0.5'");
45 shouldBe("(0.451).toFixed(1)", "'0.5'");
46 shouldBe("(0.5).toFixed(1)", "'0.5'");
47 shouldBe("(0.549).toFixed(1)", "'0.5'");
48 shouldBe("(0.55).toFixed(1)", "'0.6'");
49 shouldBe("(0.551).toFixed(1)", "'0.6'");
51 shouldBe("(-0.449).toFixed(1)", "'-0.4'");
52 shouldBe("(-0.45).toFixed(1)", "'-0.5'");
53 shouldBe("(-0.451).toFixed(1)", "'-0.5'");
54 shouldBe("(-0.5).toFixed(1)", "'-0.5'");
55 shouldBe("(-0.549).toFixed(1)", "'-0.5'");
56 shouldBe("(-0.55).toFixed(1)", "'-0.6'");
57 shouldBe("(-0.551).toFixed(1)", "'-0.6'");
64 shouldBeEqualToString("(0.0).toFixed(4)", "0.0000");
65 shouldBeEqualToString("(-0.0).toFixed(4)", "0.0000");
66 shouldBeEqualToString("(0.0).toFixed()", "0");
67 shouldBeEqualToString("(-0.0).toFixed()", "0");
70 shouldBeEqualToString("(1234.567).toFixed()", "1235");
71 shouldBeEqualToString("(1234.567).toFixed(0)", "1235");
73 shouldBeEqualToString("(1234.567).toFixed(null)", "1235");
74 shouldBeEqualToString("(1234.567).toFixed(false)", "1235");
75 shouldBeEqualToString("(1234.567).toFixed('foo')", "1235");
76 shouldBeEqualToString("(1234.567).toFixed(nan)", "1235"); // nan is treated like 0
78 shouldBeEqualToString("(1234.567).toFixed(1)", "1234.6");
79 shouldBeEqualToString("(1234.567).toFixed(true)", "1234.6"); // just like 1
80 shouldBeEqualToString("(1234.567).toFixed('1')", "1234.6"); // just like 1
82 shouldBeEqualToString("(1234.567).toFixed(2)", "1234.57");
83 shouldBeEqualToString("(1234.567).toFixed(2.9)", "1234.57");
84 shouldBeEqualToString("(1234.567).toFixed(5)", "1234.56700");
85 shouldBeEqualToString("(1234.567).toFixed(20)", "1234.56700000000000727596");
88 shouldThrow("(1234.567).toFixed(21)");
89 shouldThrow("(1234.567).toFixed(100)");
90 shouldThrow("(1234.567).toFixed(101)");
91 shouldThrow("(1234.567).toFixed(-1)");
92 shouldThrow("(1234.567).toFixed(-4)");
93 shouldThrow("(1234.567).toFixed(-5)");
94 shouldThrow("(1234.567).toFixed(-20)");
95 shouldThrow("(1234.567).toFixed(-21)");
97 shouldThrow("(1234.567).toFixed(posInf)");
98 shouldThrow("(1234.567).toFixed(negInf)");
100 shouldBeEqualToString("posInf.toFixed()", "Infinity");
101 shouldBeEqualToString("negInf.toFixed()", "-Infinity");
102 shouldBeEqualToString("nan.toFixed()", "NaN");