| 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 |
Return the string consisting of the single digit of s, |
| 7 |
followed by lowercase character 'e', followed by a plus sign '+' or minus |
| 8 |
sign '-' according to whether n-1 is positive or negative, followed by the |
| 9 |
decimal representation of the integer abs(n-1) (with no leading zeros) |
| 10 |
es5id: 9.8.1_A9_T2 |
| 11 |
description: > |
| 12 |
Various float numbers with many zeros convert to String by |
| 13 |
explicit transformation |
| 14 |
---*/ |
| 15 |
|
| 16 |
// CHECK#1 |
| 17 |
if (String(0.0000001) !== "1e-7") { |
| 18 |
throw new Test262Error('#1: String(0.0000001) === "1e-7". Actual: ' + (String(0.0000001))); |
| 19 |
} |
| 20 |
|
| 21 |
// CHECK#2 |
| 22 |
if (String(0.000000000100000000000) !== "1e-10") { |
| 23 |
throw new Test262Error('#2: String(0.000000000100000000000) === "1e-10". Actual: ' + (String(0.000000000100000000000))); |
| 24 |
} |
| 25 |
|
| 26 |
// CHECK#3 |
| 27 |
if (String(1e-7) !== "1e-7") { |
| 28 |
throw new Test262Error('#3: String(1e-7) === "1e-7". Actual: ' + (String(1e-7))); |
| 29 |
} |
| 30 |
|
| 31 |
// CHECK#4 |
| 32 |
if (String(1.0e-10) !== "1e-10") { |
| 33 |
throw new Test262Error('#4: String(1.0e-10) === "1e-10". Actual: ' + (String(1.0e-10))); |
| 34 |
} |
| 35 |
|
| 36 |
// CHECK#5 |
| 37 |
if (String(1E-7) !== "1e-7") { |
| 38 |
throw new Test262Error('#5: String(1E-7) === "1e-7". Actual: ' + (String(1E-7))); |
| 39 |
} |
| 40 |
|
| 41 |
// CHECK#6 |
| 42 |
if (String(1.0E-10) !== "1e-10") { |
| 43 |
throw new Test262Error('#6: String(1.0E-10) === "1e-10". Actual: ' + (String(1.0E-10))); |
| 44 |
} |
| 45 |
|
| 46 |
// CHECK#7 |
| 47 |
if (String(-0.0000001) !== "-1e-7") { |
| 48 |
throw new Test262Error('#7: String(-0.0000001) === "1e-7". Actual: ' + (String(-0.0000001))); |
| 49 |
} |
| 50 |
|
| 51 |
// CHECK#8 |
| 52 |
if (String(-0.000000000100000000000) !== "-1e-10") { |
| 53 |
throw new Test262Error('#8: String(-0.000000000100000000000) === "1e-10". Actual: ' + (String(-0.000000000100000000000))); |
| 54 |
} |
| 55 |
|
| 56 |
// CHECK#9 |
| 57 |
if (String(-1e-7) !== "-1e-7") { |
| 58 |
throw new Test262Error('#9: String(-1e-7) === "-1e-7". Actual: ' + (String(-1e-7))); |
| 59 |
} |
| 60 |
|
| 61 |
// CHECK#10 |
| 62 |
if (String(-1.0e-10) !== "-1e-10") { |
| 63 |
throw new Test262Error('#10: String(-1.0e-10) === "-1e-10". Actual: ' + (String(-1.0e-10))); |
| 64 |
} |
| 65 |
|
| 66 |
// CHECK#11 |
| 67 |
if (String(-1E-7) !== "-1e-7") { |
| 68 |
throw new Test262Error('#11: String(-1E-7) === "-1e-7". Actual: ' + (String(-1E-7))); |
| 69 |
} |
| 70 |
|
| 71 |
// CHECK#12 |
| 72 |
if (String(-1.0E-10) !== "-1e-10") { |
| 73 |
throw new Test262Error('#12: String(-1.0E-10) === "-1e-10". Actual: ' + (String(-1.0E-10))); |
| 74 |
} |
| 75 |
|
| 76 |
reportCompare(0, 0); |