1/* 2 * Copyright (c) 2024 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 16declare function print(arg:any):string; 17 18let len:number = 1; 19 20// Check without params 21//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 22len = Math.pow(); 23print(len); //: NaN 24 25// Check with single param 26//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 27len = Math.pow(0); 28print(len); //: NaN 29 30// Check with three param 31//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 32len = Math.pow(2, 4, 6); 33print(len); //: 16 34 35// If exponent is NaN, return NaN. 36//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 37len = Math.pow(2, NaN) 38print(len) //: NaN 39 40// If exponent is either +0.0 or -0.0, return 1.0 41//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 42len = Math.pow(3, +0.0); 43print(len); //: 1 44 45let temp = -0.0 46//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 47len = Math.pow(3, -0.0); 48print(len); //: 1 49 50// If base is -inf, then: 51// a. If exponent > +0.0, then 52// * If exponent is an odd integral Number, return -inf. Otherwise, return +inf. 53//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 54len = Math.pow(-Infinity, 5); 55print(len); //: -Infinity 56//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 57len = Math.pow(-Infinity, 6); 58print(len); //: Infinity 59// b. Else: 60// * If exponent is an odd integral Number, return -0.0. Otherwise, return +0.0. 61//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 62len = Math.pow(-Infinity, -3); 63print("1/x: " + 1 / len); //: 1/x: -Infinity 64//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 65len = Math.pow(-Infinity, -4); 66print(len); //: 0 67 68// If base is +0.0 and if exponent > +0.0, return +0.0. Otherwise, return +inf. 69//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 70len = Math.pow(+0.0, 2); 71print(len); //: 0 72//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 73len = Math.pow(+0.0, -2); 74print(len); //: Infinity 75 76 77// If base is -0.0, then 78// a. If exponent > +0.0, then 79// * If exponent is an odd integral Number, return -0.0. Otherwise, return +0.0. 80//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 81len = Math.pow(-0.0, 7); 82print("1/x: " + 1 / len); //: 1/x: -Infinity 83//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 84len = Math.pow(-0.0, 8); 85print(len); //: 0 86 87// b. Else, 88// * If exponent is an odd integral Number, return -inf. Otherwise, return +inf. 89//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 90len = Math.pow(-0.0, -9); 91print(len); //: -Infinity 92//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 93len = Math.pow(-0.0, -10); 94print(len); //: Infinity 95 96// If exponent is +inf, then 97// a. If abs(base) > 1, return +inf. 98//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 99len = Math.pow(1.5, +Infinity); 100print(len); //: Infinity 101// b. If abs(base) = 1, return NaN. 102//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 103len = Math.pow(1, +Infinity); 104print(len); //: NaN 105// c. If abs(base) < 1, return +inf. 106//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 107len = Math.pow(0.5, +Infinity); 108print(len); //: 0 109 110// If exponent is -inf, then 111// a. If abs(base) > 1, return +inf. 112//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 113len = Math.pow(1.5, -Infinity); 114print(len); //: 0 115// b. If abs(base) = 1, return NaN. 116//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 117len = Math.pow(1, -Infinity); 118print(len); //: NaN 119// c. If abs(base) < 1, return +inf. 120//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 121len = Math.pow(0.2, -Infinity); 122print(len); //: Infinity 123 124//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 125len = Math.pow(1, Infinity); 126print(len); //: NaN 127 128//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 129len = Math.pow(-1, Infinity); 130print(len); //: NaN 131 132//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 133len = Math.pow(1, -Infinity); 134print(len); //: NaN 135 136//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 137len = Math.pow(-1, -Infinity); 138print(len); //: NaN 139 140//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow 141//aot: [trace] Check Type: NotNumber1 142len = Math.pow(2, "three"); 143print(len); //: NaN 144