1/* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16var obj = { 17 2e3: function () { 18 "show source"; 19 return "Successfully called key 2e3"; 20 }, 21 1000: function () { 22 "show source"; 23 return "Successfully called key 1000"; 24 }, 25 NaN: function () { 26 "show source"; 27 return "Successfully called key NaN"; 28 }, 29 0.0: function () { 30 "show source"; 31 return "Successfully called key 0.0"; 32 }, 33 Infinity: function () { 34 "show source"; 35 return "Successfully called key Infinity"; 36 }, 37 1e-6: function () { 38 "show source"; 39 return "Successfully called key 1e-6"; 40 }, 41 0.000002: function () { 42 "show source"; 43 return "Successfully called key 0.000002"; 44 }, 45 1e-7: function () { 46 "show source"; 47 return "Successfully called key 1e-7"; 48 }, 49 0.0000002: function () { 50 "show source"; 51 return "Successfully called key 0.0000002"; 52 }, 53 0.1: function () { 54 "show source"; 55 return "Successfully called key 0.1"; 56 }, 57 1.1: function () { 58 "show source"; 59 return "Successfully called key 1.1"; 60 }, 61 1e20: function () { 62 "show source"; 63 return "Successfully called key 1e20"; 64 }, 65 200000000000000000000: function () { 66 "show source"; 67 return "Successfully called key 200000000000000000000"; 68 }, 69 1e21: function () { 70 "show source"; 71 return "Successfully called key 1e21"; 72 }, 73 2000000000000000000000: function () { 74 "show source"; 75 return "Successfully called key 2000000000000000000000"; 76 }, 77 1234567890123456: function () { 78 "show source"; 79 return "Successfully called key 1234567890123456"; 80 }, 81 12345678901234567: function () { 82 "show source"; 83 return "Successfully called key 12345678901234567"; 84 }, 85 12345678901234567: function () { 86 "show source"; 87 return "Successfully called key 12345678901234567"; 88 }, 89 123456789012345678: function () { 90 "show source"; 91 return "Successfully called key 123456789012345678"; 92 }, 93 123456789012345678: function () { 94 "show source"; 95 return "Successfully called key 123456789012345678"; 96 }, 97}; 98 99print(obj[2e3]()); // call key 2e3 100print(obj[2000]()); // call key 2e3 101print(obj[1000]()); 102// Special testcases 103print(obj[NaN]()); 104print(obj[0]()); // 0.0 == 0 105print(obj[Infinity]()); 106// Boundary value of size : 1e-6 107print(obj[1e-6]()); 108print(obj[0.000001]()); 109print(obj[0.000002]()); 110print(obj[1e-7]()); 111print(obj[0.0000001]()); 112print(obj[0.0000002]()); 113// Boundary value of size : 1e0 114print(obj[0.1]()); 115print(obj[1.1]()); 116// Boundary value of size : 1e21 117print(obj[1e20]()); 118print(obj[100000000000000000000]()); 119print(obj[200000000000000000000]()); 120print(obj[1e21]()); 121print(obj[1000000000000000000000]()); 122print(obj[2000000000000000000000]()); 123// Precision digit : 17 124print(obj[1234567890123456]()); 125print(obj[12345678901234567]()); 126print(obj[12345678901234568]()); // equal to 12345678901234567 127print(obj[123456789012345678]()); 128print(obj[123456789012345680]()); // equal to 123456789012345678 129