File indexing completed on 2024-04-28 15:28:38

0001 shouldBe("Number()", "0");
0002 shouldBe("Number(1)", "1");
0003 shouldBe("Number(1.1)", "1.1");
0004 shouldBe("Number('1.2')", "1.2");
0005 shouldBe("Number(true)", "1");
0006 shouldBe("Number(false)", "0");
0007 shouldBe("Number(null)", "0");
0008 shouldBe("isNaN(Number(undefined))", "true");
0009 shouldBe("isNaN(Number('a'))", "true");
0010 shouldBe("isNaN(Number({}))", "true");
0011 shouldBe("typeof Number(1)", "'number'");
0012 shouldBe("Number({ valueOf: function() { return 33; } })", "33");
0013 shouldBe("Number({ toString: function() { return 44; } })", "44");
0014 shouldBe("Number({ valueOf: function() { return 33; }, toString: function() { return 44; }})", "33");
0015 shouldThrow("Number({ valueOf: function() { throw 33; } })");
0016 
0017 shouldBe("(new Number()).valueOf()", "0");
0018 shouldBe("(new Number(.4)).valueOf()", "0.4");
0019 shouldBe("(new Number('1.')).valueOf()", "1");
0020 shouldBe("(new Number(true)).valueOf()", "1");
0021 shouldBe("(new Number(false)).valueOf()", "0");
0022 shouldBe("(new Number(null)).valueOf()", "0");
0023 shouldBe("isNaN(new Number(undefined))", "true");
0024 shouldBe("isNaN(new Number('a'))", "true");
0025 shouldBe("isNaN(Number({}))", "true");
0026 shouldBe("typeof new Number(1)", "'object'");
0027 
0028 shouldBe("isNaN(Number.NaN)", "true");
0029 shouldBe("Number.NEGATIVE_INFINITY", "-Infinity");
0030 shouldBe("Number.POSITIVE_INFINITY", "Infinity");
0031 // with (Number)
0032 //   shouldBe("POSITIVE_INFINITY", "Infinity");
0033 
0034 shouldBe("(1).toString()", "'1'");
0035 shouldBe("typeof (1).toString()", "'string'");
0036 shouldBe("(10).toString(16)", "'a'");
0037 shouldBe("(8.5).toString(16)", "'8.8'");
0038 shouldBe("(-8.5).toString(16)", "'-8.8'");
0039 shouldBe("Number.NaN.toString(16)", "'NaN'");
0040 shouldBe("Number.POSITIVE_INFINITY.toString(16)", "'Infinity'");
0041 shouldBe("Number.NEGATIVE_INFINITY.toString(16)", "'-Infinity'");
0042 shouldBe("Number.MAX_VALUE.toString(2).length", "1024");
0043 shouldBe("(1).valueOf()", "1");
0044 shouldBe("typeof (1).valueOf()", "'number'");
0045 
0046 function toFixedOrException(val,fractionDigits)
0047 {
0048   var s = "";
0049   try {
0050     s = String(Number(val).toFixed(fractionDigits));
0051   }
0052   catch (e) {
0053     s = String(e);
0054   }
0055   return s;
0056 }
0057 
0058 shouldBe("Number(1234.567).toFixed(0)","\"1235\"");
0059 shouldBe("Number(1234.567).toFixed(undefined)","\"1235\"");
0060 shouldBe("Number(0).toFixed(7)","\"0.0000000\"");
0061 shouldBe("Number(0.003).toFixed(0)","\"0\"");
0062 shouldBe("Number(40.1234567890123).toFixed(7)","\"40.1234568\"");
0063 shouldBe("Number(-40.1234567890123).toFixed(7)","\"-40.1234568\"");
0064 shouldBe("Number(4).toFixed(7)","\"4.0000000\"");
0065 shouldBe("Number(0.000056).toFixed(7)","\"0.0000560\"");
0066 shouldBe("Number(NaN).toFixed(7)","\"NaN\"");
0067 shouldBe("Number(Infinity).toFixed(7)","\"Infinity\"");
0068 shouldBe("Number(-Infinity).toFixed(7)","\"-Infinity\"");
0069 shouldBe("Number(Math.pow(10,4)).toFixed(13)","\"10000.0000000000000\"");
0070 shouldBe("Number(Math.pow(10,17)).toFixed(16)","\"100000000000000000.0000000000000000\"");
0071 shouldBe("Number(Math.pow(10,18)).toFixed(17)","\"1000000000000000000.00000000000000000\"");
0072 shouldBe("Number(Math.pow(10,19)).toFixed(18)","\"10000000000000000000.000000000000000000\"");
0073 shouldBe("Number(Math.pow(10,17)).toFixed(20)","\"100000000000000000.00000000000000000000\"");
0074 shouldBe("Number(Math.pow(10,18)).toFixed(20)","\"1000000000000000000.00000000000000000000\"");
0075 shouldBe("Number(Math.pow(10,19)).toFixed(20)","\"10000000000000000000.00000000000000000000\"");
0076 shouldBe("Number(Math.pow(10,20)).toFixed(20)","\"100000000000000000000.00000000000000000000\"");
0077 shouldBe("Number(Math.pow(10,21)).toFixed(20)","\"1e+21\"");
0078 shouldBeTrue("toFixedOrException(2,-1).indexOf('Range') >= 0");
0079 shouldBe("toFixedOrException(2,0)","\"2\"");
0080 shouldBe("toFixedOrException(2,20)","\"2.00000000000000000000\"");
0081 shouldBeTrue("toFixedOrException(2,21).indexOf('Range') >= 0");
0082 
0083 
0084 
0085 
0086 shouldBe("Number(NaN).toExponential()","\"NaN\"");
0087 shouldBe("Number(Infinity).toExponential()","\"Infinity\"");
0088 shouldBe("Number(-Infinity).toExponential()","\"-Infinity\"");
0089 shouldBe("Number(NaN).toExponential(4)","\"NaN\"");
0090 shouldBe("Number(Infinity).toExponential(4)","\"Infinity\"");
0091 shouldBe("Number(-Infinity).toExponential(4)","\"-Infinity\"");
0092 shouldBe("Number(123.456).toExponential()","\"1.23456e+2\"");
0093 shouldBeTrue("try { Number(123.456).toExponential(-1) } catch (e) { String(e).indexOf('Range') >= 0; }");
0094 shouldBe("Number(123.456).toExponential(0)","\"1e+2\"");
0095 shouldBe("Number(123.456).toExponential(1)","\"1.2e+2\"");
0096 shouldBe("Number(123.456).toExponential(2)","\"1.23e+2\"");
0097 shouldBe("Number(123.456).toExponential(3)","\"1.235e+2\"");
0098 shouldBe("Number(123.456).toExponential(4)","\"1.2346e+2\"");
0099 shouldBe("Number(123.456).toExponential(5)","\"1.23456e+2\"");
0100 shouldBe("Number(123.456).toExponential(6)","\"1.234560e+2\"");
0101 shouldBe("Number(123.456).toExponential(7)","\"1.2345600e+2\"");
0102 shouldBe("Number(123.456).toExponential(8)","\"1.23456000e+2\"");
0103 shouldBe("Number(123.456).toExponential(9)","\"1.234560000e+2\"");
0104 shouldBe("Number(123.456).toExponential(10)","\"1.2345600000e+2\"");
0105 shouldBe("Number(123.456).toExponential(11)","\"1.23456000000e+2\"");
0106 shouldBe("Number(123.456).toExponential(12)","\"1.234560000000e+2\"");
0107 shouldBe("Number(123.456).toExponential(13)","\"1.2345600000000e+2\"");
0108 shouldBe("Number(123.456).toExponential(14)","\"1.23456000000000e+2\"");
0109 shouldBe("Number(123.456).toExponential(15)","\"1.234560000000000e+2\"");
0110 shouldBe("Number(123.456).toExponential(16)","\"1.2345600000000000e+2\"");
0111 shouldBe("Number(123.456).toExponential(17)","\"1.23456000000000000e+2\"");
0112 shouldBe("Number(123.456).toExponential(18)","\"1.234560000000000000e+2\"");
0113 shouldBe("Number(123.456).toExponential(19)","\"1.2345600000000000000e+2\"");
0114 shouldBe("Number(123.456).toExponential(20)","\"1.23456000000000000000e+2\"");
0115 shouldBeTrue("try { Number(123.456).toExponential(21) } catch (e) { String(e).indexOf('Range') >= 0; }");
0116 shouldBe("Number(.000123456).toExponential()","\"1.23456e-4\"");
0117 shouldBeTrue("try { Number(.000123456).toExponential(-1) } catch (e) { String(e).indexOf('Range') >= 0; }");
0118 shouldBe("Number(.000123456).toExponential(0)","\"1e-4\"");
0119 shouldBe("Number(.000123456).toExponential(1)","\"1.2e-4\"");
0120 shouldBe("Number(.000123456).toExponential(2)","\"1.23e-4\"");
0121 shouldBe("Number(.000123456).toExponential(3)","\"1.235e-4\"");
0122 shouldBe("Number(.000123456).toExponential(4)","\"1.2346e-4\"");
0123 shouldBe("Number(.000123456).toExponential(5)","\"1.23456e-4\"");
0124 shouldBe("Number(.000123456).toExponential(6)","\"1.234560e-4\"");
0125 shouldBe("Number(.000123456).toExponential(7)","\"1.2345600e-4\"");
0126 shouldBe("Number(.000123456).toExponential(8)","\"1.23456000e-4\"");
0127 shouldBe("Number(.000123456).toExponential(9)","\"1.234560000e-4\"");
0128 shouldBe("Number(.000123456).toExponential(10)","\"1.2345600000e-4\"");
0129 shouldBe("Number(.000123456).toExponential(11)","\"1.23456000000e-4\"");
0130 shouldBe("Number(.000123456).toExponential(12)","\"1.234560000000e-4\"");
0131 shouldBe("Number(.000123456).toExponential(13)","\"1.2345600000000e-4\"");
0132 shouldBe("Number(.000123456).toExponential(14)","\"1.23456000000000e-4\"");
0133 shouldBe("Number(.000123456).toExponential(15)","\"1.234560000000000e-4\"");
0134 shouldBe("Number(.000123456).toExponential(16)","\"1.2345600000000000e-4\"");
0135 shouldBe("Number(.000123456).toExponential(17)","\"1.23456000000000000e-4\"");
0136 shouldBe("Number(.000123456).toExponential(18)","\"1.234560000000000000e-4\"");
0137 shouldBe("Number(.000123456).toExponential(19)","\"1.2345600000000000000e-4\"");
0138 shouldBe("Number(.000123456).toExponential(20)","\"1.23456000000000000000e-4\"");
0139 shouldBeTrue("try { Number(.000123456).toExponential(21) } catch (e) { String(e).indexOf('Range') >= 0; }");
0140 shouldBe("Number(123.4567890123456789012).toExponential()","\"1.2345678901234568e+2\"");
0141 shouldBeTrue("try { Number(123.4567890123456789012).toExponential(-1) } catch (e) { String(e).indexOf('Range') >= 0; }");
0142 shouldBe("Number(123.4567890123456789012).toExponential(0)","\"1e+2\"");
0143 shouldBe("Number(123.4567890123456789012).toExponential(1)","\"1.2e+2\"");
0144 shouldBe("Number(123.4567890123456789012).toExponential(2)","\"1.23e+2\"");
0145 shouldBe("Number(123.4567890123456789012).toExponential(3)","\"1.235e+2\"");
0146 shouldBe("Number(123.4567890123456789012).toExponential(4)","\"1.2346e+2\"");
0147 shouldBe("Number(123.4567890123456789012).toExponential(5)","\"1.23457e+2\"");
0148 shouldBe("Number(123.4567890123456789012).toExponential(6)","\"1.234568e+2\"");
0149 shouldBe("Number(123.4567890123456789012).toExponential(7)","\"1.2345679e+2\"");
0150 shouldBe("Number(123.4567890123456789012).toExponential(8)","\"1.23456789e+2\"");
0151 shouldBe("Number(123.4567890123456789012).toExponential(9)","\"1.234567890e+2\"");
0152 shouldBe("Number(123.4567890123456789012).toExponential(10)","\"1.2345678901e+2\"");
0153 shouldBe("Number(123.4567890123456789012).toExponential(11)","\"1.23456789012e+2\"");
0154 shouldBe("Number(123.4567890123456789012).toExponential(12)","\"1.234567890123e+2\"");
0155 shouldBe("Number(123.4567890123456789012).toExponential(13)","\"1.2345678901235e+2\"");
0156 shouldBe("Number(123.4567890123456789012).toExponential(14)","\"1.23456789012346e+2\"");
0157 shouldBe("Number(123.4567890123456789012).toExponential(15)","\"1.234567890123457e+2\"");
0158 shouldBe("Number(123.4567890123456789012).toExponential(16)","\"1.2345678901234570e+2\"");
0159 shouldBe("Number(123.4567890123456789012).toExponential(17)","\"1.23456789012345700e+2\"");
0160 shouldBe("Number(123.4567890123456789012).toExponential(18)","\"1.234567890123457100e+2\"");
0161 shouldBe("Number(123.4567890123456789012).toExponential(19)","\"1.2345678901234570000e+2\"");
0162 shouldBe("Number(123.4567890123456789012).toExponential(20)","\"1.23456789012345700000e+2\"");
0163 shouldBeTrue("try { Number(123.4567890123456789012).toExponential(21) } catch (e) { String(e).indexOf('Range') >= 0; }");
0164 shouldBe("Number(.0000000000000000000001).toExponential()","\"1e-22\"");
0165 shouldBe("Number(.0000000000000000000012).toExponential()","\"1.2e-21\"");
0166 shouldBe("Number(.0000000000000000000123).toExponential()","\"1.23e-20\"");
0167 shouldBe("Number(.0000000000000000000123).toExponential()","\"1.23e-20\"");
0168 shouldBe("Number(.0000000000000000001234).toExponential()","\"1.234e-19\"");
0169 shouldBe("Number(.0000000000000000012345).toExponential()","\"1.2345e-18\"");
0170 shouldBe("Number(.0000000000000000123456).toExponential()","\"1.23456e-17\"");
0171 shouldBe("Number(.0000000000000001234567).toExponential()","\"1.234567e-16\"");
0172 shouldBe("Number(.0000000000000012345678).toExponential()","\"1.2345678e-15\"");
0173 shouldBe("Number(.0000000000000123456789).toExponential()","\"1.23456789e-14\"");
0174 shouldBe("Number(.0000000000001234567890).toExponential()","\"1.23456789e-13\"");
0175 shouldBe("Number(.0000000000012345678901).toExponential()","\"1.2345678901e-12\"");
0176 shouldBe("Number(.0000000000123456789012).toExponential()","\"1.23456789012e-11\"");
0177 shouldBe("Number(.0000000001234567890123).toExponential()","\"1.234567890123e-10\"");
0178 shouldBe("Number(.0000000012345678901234).toExponential()","\"1.2345678901234e-9\"");
0179 shouldBe("Number(.0000000123456789012345).toExponential()","\"1.23456789012345e-8\"");
0180 shouldBe("Number(.0000001234567890123456).toExponential()","\"1.234567890123456e-7\"");
0181 shouldBe("Number(.0000012345678901234567).toExponential()","\"1.2345678901234567e-6\"");
0182 shouldBe("Number(.0000123456789012345678).toExponential()","\"1.2345678901234568e-5\"");
0183 shouldBe("Number(.0001234567890123456789).toExponential()","\"1.2345678901234567e-4\"");
0184 shouldBe("Number(.0012345678901234567890).toExponential()","\"1.2345678901234567e-3\"");
0185 shouldBe("Number(.0123456789012345678901).toExponential()","\"1.2345678901234568e-2\"");
0186 shouldBe("Number(1.234567890123456789012).toExponential()","\"1.2345678901234567e+0\"");
0187 shouldBe("Number(12.34567890123456789012).toExponential()","\"1.2345678901234567e+1\"");
0188 shouldBe("Number(123.4567890123456789012).toExponential()","\"1.2345678901234568e+2\"");
0189 shouldBe("Number(1234.567890123456789012).toExponential()","\"1.234567890123457e+3\"");
0190 shouldBe("Number(12345.67890123456789012).toExponential()","\"1.2345678901234567e+4\"");
0191 shouldBe("Number(123456.7890123456789012).toExponential()","\"1.2345678901234567e+5\"");
0192 shouldBe("Number(1234567.890123456789012).toExponential()","\"1.2345678901234567e+6\"");
0193 shouldBe("Number(12345678.90123456789012).toExponential()","\"1.2345678901234567e+7\"");
0194 shouldBe("Number(123456789.0123456789012).toExponential()","\"1.2345678901234567e+8\"");
0195 shouldBe("Number(1234567890.123456789012).toExponential()","\"1.2345678901234567e+9\"");
0196 shouldBe("Number(12345678901.23456789012).toExponential()","\"1.2345678901234568e+10\"");
0197 shouldBe("Number(123456789012.3456789012).toExponential()","\"1.2345678901234567e+11\"");
0198 shouldBe("Number(1234567890123.456789012).toExponential()","\"1.2345678901234568e+12\"");
0199 shouldBe("Number(12345678901234.56789012).toExponential()","\"1.2345678901234568e+13\"");
0200 shouldBe("Number(123456789012345.6789012).toExponential()","\"1.2345678901234567e+14\"");
0201 shouldBe("Number(1234567890123456.789012).toExponential()","\"1.2345678901234568e+15\"");
0202 shouldBe("Number(12345678901234567.89012).toExponential()","\"1.2345678901234568e+16\"");
0203 shouldBe("Number(123456789012345678.9012).toExponential()","\"1.2345678901234568e+17\"");
0204 shouldBe("Number(1234567890123456789.012).toExponential()","\"1.2345678901234568e+18\"");
0205 shouldBe("Number(12345678901234567890.12).toExponential()","\"1.2345678901234567e+19\"");
0206 shouldBe("Number(123456789012345678901.2).toExponential()","\"1.2345678901234568e+20\"");
0207 shouldBe("Number(-18450000000000000000).toExponential(6)", "\"-1.845000e+19\"");
0208 
0209 shouldBeTrue("try { Number(1).toPrecision(-1); } catch (e) { String(e).indexOf('Range') >= 0; }");
0210 shouldBeTrue("try { Number(1).toPrecision(0); } catch (e) { String(e).indexOf('Range') >= 0; }");
0211 shouldBe("try { Number(1).toPrecision(1); } catch (e) { String(e); }","\"1\"");
0212 shouldBe("try { Number(1).toPrecision(21); } catch (e) { String(e); }","\"1.00000000000000000000\"");
0213 shouldBeTrue("try { Number(1).toPrecision(22); } catch (e) { String(e).indexOf('Range') >= 0; }");
0214 shouldBe("Number(NaN).toPrecision()","\"NaN\"");
0215 shouldBe("Number(NaN).toPrecision(1)","\"NaN\"");
0216 shouldBe("Number(Infinity).toPrecision()","\"Infinity\"");
0217 shouldBe("Number(Infinity).toPrecision(1)","\"Infinity\"");
0218 shouldBe("Number(-Infinity).toPrecision()","\"-Infinity\"");
0219 shouldBe("Number(-Infinity).toPrecision(1)","\"-Infinity\"");
0220 shouldBe("Number(.0000000012345).toPrecision(2)","\"1.2e-9\"");
0221 shouldBe("Number(.000000012345).toPrecision(2)","\"1.2e-8\"");
0222 shouldBe("Number(.00000012345).toPrecision(2)","\"1.2e-7\"");
0223 shouldBe("Number(.0000012345).toPrecision(2)","\"0.0000012\"");
0224 shouldBe("Number(.000012345).toPrecision(2)","\"0.000012\"");
0225 shouldBe("Number(.00012345).toPrecision(2)","\"0.00012\"");
0226 shouldBe("Number(.0012345).toPrecision(2)","\"0.0012\"");
0227 shouldBe("Number(.012345).toPrecision(2)","\"0.012\"");
0228 shouldBe("Number(.12345).toPrecision(2)","\"0.12\"");
0229 shouldBe("Number(1.2345).toPrecision(2)","\"1.2\"");
0230 shouldBe("Number(12.345).toPrecision(2)","\"12\"");
0231 shouldBe("Number(123.45).toPrecision(2)","\"1.2e+2\"");
0232 shouldBe("Number(1234.5).toPrecision(2)","\"1.2e+3\"");
0233 shouldBe("Number(12345).toPrecision(2)","\"1.2e+4\"");
0234 shouldBe("Number(12345.67).toPrecision(4)","\"1.235e+4\"");
0235 shouldBe("Number(12344.67).toPrecision(4)","\"1.234e+4\"");
0236 shouldBe("Number(0.0001234567890123456789012345).toPrecision()","\"0.00012345678901234567\"");
0237 shouldBe("Number(0.0001234567890123456789012345).toPrecision(1)","\"0.0001\"");
0238 shouldBe("Number(0.0001234567890123456789012345).toPrecision(2)","\"0.00012\"");
0239 shouldBe("Number(0.0001234567890123456789012345).toPrecision(3)","\"0.000123\"");
0240 shouldBe("Number(0.0001234567890123456789012345).toPrecision(4)","\"0.0001235\"");
0241 shouldBe("Number(0.0001234567890123456789012345).toPrecision(5)","\"0.00012346\"");
0242 shouldBe("Number(0.0001234567890123456789012345).toPrecision(6)","\"0.000123457\"");
0243 shouldBe("Number(0.0001234567890123456789012345).toPrecision(7)","\"0.0001234568\"");
0244 shouldBe("Number(0.0001234567890123456789012345).toPrecision(8)","\"0.00012345679\"");
0245 shouldBe("Number(0.0001234567890123456789012345).toPrecision(9)","\"0.000123456789\"");
0246 shouldBe("Number(0.0001234567890123456789012345).toPrecision(10)","\"0.0001234567890\"");
0247 shouldBe("Number(0.0001234567890123456789012345).toPrecision(11)","\"0.00012345678901\"");
0248 shouldBe("Number(0.0001234567890123456789012345).toPrecision(12)","\"0.000123456789012\"");
0249 shouldBe("Number(0.0001234567890123456789012345).toPrecision(13)","\"0.0001234567890123\"");
0250 shouldBe("Number(0.0001234567890123456789012345).toPrecision(14)","\"0.00012345678901235\"");
0251 shouldBe("Number(0.0001234567890123456789012345).toPrecision(15)","\"0.000123456789012346\"");
0252 shouldBe("Number(0.0001234567890123456789012345).toPrecision(16)","\"0.0001234567890123457\"");
0253 shouldBe("Number(0.0001234567890123456789012345).toPrecision(17)","\"0.00012345678901234568\"");
0254 shouldBe("Number(0.0001234567890123456789012345).toPrecision(18)","\"0.000123456789012345680\"");
0255 shouldBe("Number(0.0001234567890123456789012345).toPrecision(19)","\"0.0001234567890123456800\"");
0256 shouldBe("Number(0.0001234567890123456789012345).toPrecision(20)","\"0.00012345678901234567000\"");
0257 shouldBe("Number(0.0001234567890123456789012345).toPrecision(21)","\"0.000123456789012345680000\"");
0258 shouldBe("Number(12345.67890123456789012345).toPrecision()","\"12345.678901234567\"");
0259 shouldBe("Number(12345.67890123456789012345).toPrecision(1)","\"1e+4\"");
0260 shouldBe("Number(12345.67890123456789012345).toPrecision(2)","\"1.2e+4\"");
0261 shouldBe("Number(12345.67890123456789012345).toPrecision(3)","\"1.23e+4\"");
0262 shouldBe("Number(12345.67890123456789012345).toPrecision(4)","\"1.235e+4\"");
0263 shouldBe("Number(12345.67890123456789012345).toPrecision(5)","\"12346\"");
0264 shouldBe("Number(12345.67890123456789012345).toPrecision(6)","\"12345.7\"");
0265 shouldBe("Number(12345.67890123456789012345).toPrecision(7)","\"12345.68\"");
0266 shouldBe("Number(12345.67890123456789012345).toPrecision(8)","\"12345.679\"");
0267 shouldBe("Number(12345.67890123456789012345).toPrecision(9)","\"12345.6789\"");
0268 shouldBe("Number(12345.67890123456789012345).toPrecision(10)","\"12345.67890\"");
0269 shouldBe("Number(12345.67890123456789012345).toPrecision(11)","\"12345.678901\"");
0270 shouldBe("Number(12345.67890123456789012345).toPrecision(12)","\"12345.6789012\"");
0271 shouldBe("Number(12345.67890123456789012345).toPrecision(13)","\"12345.67890123\"");
0272 shouldBe("Number(12345.67890123456789012345).toPrecision(14)","\"12345.678901235\"");
0273 shouldBe("Number(12345.67890123456789012345).toPrecision(15)","\"12345.6789012346\"");
0274 shouldBe("Number(12345.67890123456789012345).toPrecision(16)","\"12345.67890123457\"");
0275 shouldBe("Number(12345.67890123456789012345).toPrecision(17)","\"12345.678901234568\"");
0276 shouldBe("Number(12345.67890123456789012345).toPrecision(18)","\"12345.6789012345660\"");
0277 shouldBe("Number(12345.67890123456789012345).toPrecision(19)","\"12345.67890123456800\"");
0278 shouldBe("Number(12345.67890123456789012345).toPrecision(20)","\"12345.678901234565000\"");
0279 shouldBe("Number(12345.67890123456789012345).toPrecision(21)","\"12345.6789012345670000\"");
0280 shouldBe("Number(0).toPrecision()","\"0\"");
0281 shouldBe("Number(0).toPrecision(1)","\"0\"");
0282 shouldBe("Number(0).toPrecision(2)","\"0.0\"");
0283 shouldBe("Number(0).toPrecision(3)","\"0.00\"");
0284 shouldBe("Number(0).toPrecision(4)","\"0.000\"");
0285 shouldBe("Number(0).toPrecision(5)","\"0.0000\"");
0286 shouldBe("Number(0).toPrecision(6)","\"0.00000\"");
0287 shouldBe("Number(0).toPrecision(7)","\"0.000000\"");
0288 shouldBe("Number(0).toPrecision(8)","\"0.0000000\"");
0289 shouldBe("Number(0).toPrecision(9)","\"0.00000000\"");
0290 shouldBe("Number(0).toPrecision(10)","\"0.000000000\"");
0291 shouldBe("Number(0).toPrecision(11)","\"0.0000000000\"");
0292 shouldBe("Number(0).toPrecision(12)","\"0.00000000000\"");
0293 shouldBe("Number(0).toPrecision(13)","\"0.000000000000\"");
0294 shouldBe("Number(0).toPrecision(14)","\"0.0000000000000\"");
0295 shouldBe("Number(0).toPrecision(15)","\"0.00000000000000\"");
0296 shouldBe("Number(0).toPrecision(16)","\"0.000000000000000\"");
0297 shouldBe("Number(0).toPrecision(17)","\"0.0000000000000000\"");
0298 shouldBe("Number(0).toPrecision(18)","\"0.00000000000000000\"");
0299 shouldBe("Number(0).toPrecision(19)","\"0.000000000000000000\"");
0300 shouldBe("Number(0).toPrecision(20)","\"0.0000000000000000000\"");
0301 shouldBe("Number(0).toPrecision(21)","\"0.00000000000000000000\"");
0302 
0303 // http://bugs.kde.org/136734
0304 shouldBe("(1.0).toPrecision(6)", "'1.00000'");
0305 shouldBe("(10.0).toPrecision(6)", "'10.0000'");
0306 shouldBe("(0.1).toPrecision(6)", "'0.100000'");
0307 shouldBe("(1.000000001).toPrecision(6)", "'1.00000'");
0308 shouldBe("(-0.0).toPrecision(3)", "'0.00'");
0309 shouldBe("(-0.0).toFixed()", "'0'");
0310 shouldBe("(-0.0).toFixed(3)", "'0.000'");
0311 shouldBe("(-0.00001).toFixed(3)", "'-0.000'");
0312 
0313 shouldBe("Number.length", "1");
0314 shouldBe("Number(Number.prototype)", "0");
0315 shouldBeTrue("Number.prototype.constructor === Number");
0316 shouldBeTrue("(new Number()).__proto__ == Number.prototype");
0317 shouldBeTrue("Number().__proto__ == Number.prototype");
0318 
0319 // 'this' object has to be a number
0320 var f = Number.prototype.toFixed;
0321 shouldBe("f.call(1, 2)", "'1.00'");
0322 shouldBe("f.call(new Number(3), 2)", "'3.00'");
0323 shouldThrow("f.call(undefined, 2)");
0324 shouldThrow("f.call(null, 2)");
0325 shouldThrow("f.call({}, 2)");