S9.8.1_A8.js (1624B)
1 // Copyright 2009 the Sputnik authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 4 /*--- 5 info: | 6 If 1 > s > -1, and -6 < n <= 0, return the string consisting of the 7 character '0', followed by a decimal point '.', followed by -n occurrences 8 of the character '0', followed by the k digits of the decimal 9 representation of s 10 es5id: 9.8.1_A8 11 description: Various float numbers convert to String by explicit transformation 12 ---*/ 13 14 // CHECK#1 15 if (String(0.1) !== "0.1") { 16 throw new Test262Error('#1: String(0.1) === "0.1". Actual: ' + (String(0.1))); 17 } 18 19 // CHECK#2 20 if (String(0.000001) !== "0.000001") { 21 throw new Test262Error('#2: String(0.000001) === "0.000001". Actual: ' + (String(0.000001))); 22 } 23 24 // CHECK#3 25 if (String(1e-6) !== "0.000001") { 26 throw new Test262Error('#3: String(1e-6) === "0.000001". Actual: ' + (String(1e-6))); 27 } 28 29 // CHECK#4 30 if (String(1E-6) !== "0.000001") { 31 throw new Test262Error('#4: String(1E-6) === "0.000001". Actual: ' + (String(1E-6))); 32 } 33 34 // CHECK#5 35 if (String(-0.1) !== "-0.1") { 36 throw new Test262Error('#5: String(-0.1) === "-0.1". Actual: ' + (String(-0.1))); 37 } 38 39 // CHECK#6 40 if (String(-0.000001) !== "-0.000001") { 41 throw new Test262Error('#6: String(-0.000001) === "-0.000001". Actual: ' + (String(-0.000001))); 42 } 43 44 // CHECK#7 45 if (String(-1e-6) !== "-0.000001") { 46 throw new Test262Error('#7: String(-1e-6) === "0.000001". Actual: ' + (String(-1e-6))); 47 } 48 49 // CHECK#8 50 if (String(-1E-6) !== "-0.000001") { 51 throw new Test262Error('#8: String(-1E-6) === "0.000001". Actual: ' + (String(-1E-6))); 52 } 53 54 reportCompare(0, 0);