/* * Copyright (c) 2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var values = [ 127, // 2 ** 7 - 1 128, // 2 ** 7 32767, // 2 ** 15 - 1 32768, // 2 ** 15 2147483647, // 2 ** 31 - 1 2147483648, // 2 ** 31 255, // 2 ** 8 - 1 256, // 2 ** 8 65535, // 2 ** 16 - 1 65536, // 2 ** 16 4294967295, // 2 ** 32 - 1 4294967296, // 2 ** 32 9007199254740991, // 2 ** 53 - 1 9007199254740992, // 2 ** 53 1.1, 0.1, 0.5, 0.50000001, 0.6, 0.7, undefined, -1, -0, -0.1, -1.1, NaN, -127, // - ( 2 ** 7 - 1 ) -128, // - ( 2 ** 7 ) -32767, // - ( 2 ** 15 - 1 ) -32768, // - ( 2 ** 15 ) -2147483647, // - ( 2 ** 31 - 1 ) -2147483648, // - ( 2 ** 31 ) -255, // - ( 2 ** 8 - 1 ) -256, // - ( 2 ** 8 ) -65535, // - ( 2 ** 16 - 1 ) -65536, // - ( 2 ** 16 ) -4294967295, // - ( 2 ** 32 - 1 ) -4294967296, // - ( 2 ** 32 ) Infinity, -Infinity, 0 ]; print('---------------- builtins number for') for (let value of values) { print(value, Number.isInteger(value), Number.isSafeInteger(value)); } print('---------------- builtins number forEach') values.forEach(function (value, i) { print(value, Number.isInteger(value), Number.isSafeInteger(value)); });