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 16let number = { 17 2e3 : 'scientific notation', 18 1000 : 'decimal', 19 NaN : NaN, 20 0.0 : '0', 21 Infinity : 'Infinity', 22 1e-6 : 0.000001, 23 0.000002 : 0.000002, 24 1e-7 : 1e-7, 25 0.0000002 : 2e-7, 26 0.1 : 0.1, 27 1.1 : 1.1, 28 1234567890123456 : 1234567890123456, 29 12345678901234567 : 12345678901234568, 30 123456789012345678 : 123456789012345680, 31 1e20 : 100000000000000000000, 32 200000000000000000000 : 100000000000000000000, 33 1e21 : 1e+21, 34 2000000000000000000000 : 2e+21, 35} 36 37print(number[2e3]); // call key 2e3 38print(number[2000]); // call key 2e3 39print(number[1000]); 40// Special testcases 41print(number[NaN]); 42print(number[0]); // equal to 0.0 43print(number[Infinity]); 44// Boundary value of size : 1e-6 45print(number[1e-6]); 46print(number[0.000001]); 47print(number[0.000002]); 48print(number[1e-7]); 49print(number[0.0000001]); 50print(number[0.0000002]); 51// Boundary value of size : 1e0 52print(number[0.1]); 53print(number[1.1]); 54// Boundary value of size : 1e21 55print(number[1e20]); 56print(number[100000000000000000000]); 57print(number[200000000000000000000]); 58print(number[1e21]); 59print(number[1000000000000000000000]); 60print(number[2000000000000000000000]); 61// Precision digit : 17 62print(number[1234567890123456]); 63print(number[12345678901234567]); 64print(number[12345678901234568]); // equal to 12345678901234567 65print(number[123456789012345678]); 66print(number[123456789012345680]); // equal to 123456789012345678 67