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 values = [ 17 127, // 2 ** 7 - 1 18 128, // 2 ** 7 19 32767, // 2 ** 15 - 1 20 32768, // 2 ** 15 21 2147483647, // 2 ** 31 - 1 22 2147483648, // 2 ** 31 23 255, // 2 ** 8 - 1 24 256, // 2 ** 8 25 65535, // 2 ** 16 - 1 26 65536, // 2 ** 16 27 4294967295, // 2 ** 32 - 1 28 4294967296, // 2 ** 32 29 9007199254740991, // 2 ** 53 - 1 30 9007199254740992, // 2 ** 53 31 1.1, 32 0.1, 33 0.5, 34 0.50000001, 35 0.6, 36 0.7, 37 undefined, 38 -1, 39 -0, 40 -0.1, 41 -1.1, 42 NaN, 43 -127, // - ( 2 ** 7 - 1 ) 44 -128, // - ( 2 ** 7 ) 45 -32767, // - ( 2 ** 15 - 1 ) 46 -32768, // - ( 2 ** 15 ) 47 -2147483647, // - ( 2 ** 31 - 1 ) 48 -2147483648, // - ( 2 ** 31 ) 49 -255, // - ( 2 ** 8 - 1 ) 50 -256, // - ( 2 ** 8 ) 51 -65535, // - ( 2 ** 16 - 1 ) 52 -65536, // - ( 2 ** 16 ) 53 -4294967295, // - ( 2 ** 32 - 1 ) 54 -4294967296, // - ( 2 ** 32 ) 55 Infinity, 56 -Infinity, 57 0 58]; 59 60print('---------------- builtins number for') 61for (let value of values) { 62 print(value, Number.isInteger(value), Number.isSafeInteger(value)); 63} 64 65print('---------------- builtins number forEach') 66values.forEach(function (value, i) { 67 print(value, Number.isInteger(value), Number.isSafeInteger(value)); 68});