14514f5e3Sopenharmony_ci/*
24514f5e3Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
34514f5e3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
44514f5e3Sopenharmony_ci * you may not use this file except in compliance with the License.
54514f5e3Sopenharmony_ci * You may obtain a copy of the License at
64514f5e3Sopenharmony_ci *
74514f5e3Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
84514f5e3Sopenharmony_ci *
94514f5e3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
104514f5e3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
114514f5e3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124514f5e3Sopenharmony_ci * See the License for the specific language governing permissions and
134514f5e3Sopenharmony_ci * limitations under the License.
144514f5e3Sopenharmony_ci */
154514f5e3Sopenharmony_ci
164514f5e3Sopenharmony_cideclare function print(arg:any):string;
174514f5e3Sopenharmony_ci
184514f5e3Sopenharmony_cilet len:number = 1;
194514f5e3Sopenharmony_ci
204514f5e3Sopenharmony_ci// Check without params
214514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
224514f5e3Sopenharmony_cilen = Math.pow();
234514f5e3Sopenharmony_ciprint(len); //: NaN
244514f5e3Sopenharmony_ci
254514f5e3Sopenharmony_ci// Check with single param
264514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
274514f5e3Sopenharmony_cilen = Math.pow(0);
284514f5e3Sopenharmony_ciprint(len); //: NaN
294514f5e3Sopenharmony_ci
304514f5e3Sopenharmony_ci// Check with three param
314514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
324514f5e3Sopenharmony_cilen = Math.pow(2, 4, 6);
334514f5e3Sopenharmony_ciprint(len); //: 16
344514f5e3Sopenharmony_ci
354514f5e3Sopenharmony_ci// If exponent is NaN, return NaN.
364514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
374514f5e3Sopenharmony_cilen = Math.pow(2, NaN)
384514f5e3Sopenharmony_ciprint(len) //: NaN
394514f5e3Sopenharmony_ci
404514f5e3Sopenharmony_ci// If exponent is either +0.0 or -0.0, return 1.0
414514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
424514f5e3Sopenharmony_cilen = Math.pow(3, +0.0);
434514f5e3Sopenharmony_ciprint(len); //: 1
444514f5e3Sopenharmony_ci
454514f5e3Sopenharmony_cilet temp = -0.0
464514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
474514f5e3Sopenharmony_cilen = Math.pow(3, -0.0);
484514f5e3Sopenharmony_ciprint(len); //: 1
494514f5e3Sopenharmony_ci
504514f5e3Sopenharmony_ci// If base is -inf, then:
514514f5e3Sopenharmony_ci// a. If exponent > +0.0, then
524514f5e3Sopenharmony_ci//  * If exponent is an odd integral Number, return -inf. Otherwise, return +inf.
534514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
544514f5e3Sopenharmony_cilen = Math.pow(-Infinity, 5);
554514f5e3Sopenharmony_ciprint(len); //: -Infinity
564514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
574514f5e3Sopenharmony_cilen = Math.pow(-Infinity, 6);
584514f5e3Sopenharmony_ciprint(len); //: Infinity
594514f5e3Sopenharmony_ci// b. Else:
604514f5e3Sopenharmony_ci//  * If exponent is an odd integral Number, return -0.0. Otherwise, return +0.0.
614514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
624514f5e3Sopenharmony_cilen = Math.pow(-Infinity, -3);
634514f5e3Sopenharmony_ciprint("1/x: " + 1 / len); //: 1/x: -Infinity
644514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
654514f5e3Sopenharmony_cilen = Math.pow(-Infinity, -4);
664514f5e3Sopenharmony_ciprint(len); //: 0
674514f5e3Sopenharmony_ci
684514f5e3Sopenharmony_ci// If base is +0.0 and if exponent > +0.0, return +0.0. Otherwise, return +inf.
694514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
704514f5e3Sopenharmony_cilen = Math.pow(+0.0, 2);
714514f5e3Sopenharmony_ciprint(len); //: 0
724514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
734514f5e3Sopenharmony_cilen = Math.pow(+0.0, -2);
744514f5e3Sopenharmony_ciprint(len); //: Infinity
754514f5e3Sopenharmony_ci
764514f5e3Sopenharmony_ci
774514f5e3Sopenharmony_ci// If base is -0.0, then
784514f5e3Sopenharmony_ci// a. If exponent > +0.0, then
794514f5e3Sopenharmony_ci//  * If exponent is an odd integral Number, return -0.0. Otherwise, return +0.0.
804514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
814514f5e3Sopenharmony_cilen = Math.pow(-0.0, 7);
824514f5e3Sopenharmony_ciprint("1/x: " + 1 / len); //: 1/x: -Infinity
834514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
844514f5e3Sopenharmony_cilen = Math.pow(-0.0, 8);
854514f5e3Sopenharmony_ciprint(len); //: 0
864514f5e3Sopenharmony_ci
874514f5e3Sopenharmony_ci// b. Else,
884514f5e3Sopenharmony_ci//  * If exponent is an odd integral Number, return -inf. Otherwise, return +inf.
894514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
904514f5e3Sopenharmony_cilen = Math.pow(-0.0, -9);
914514f5e3Sopenharmony_ciprint(len); //: -Infinity
924514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
934514f5e3Sopenharmony_cilen = Math.pow(-0.0, -10);
944514f5e3Sopenharmony_ciprint(len); //: Infinity
954514f5e3Sopenharmony_ci
964514f5e3Sopenharmony_ci// If exponent is +inf, then
974514f5e3Sopenharmony_ci// a. If abs(base) > 1, return +inf.
984514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
994514f5e3Sopenharmony_cilen = Math.pow(1.5, +Infinity);
1004514f5e3Sopenharmony_ciprint(len); //: Infinity
1014514f5e3Sopenharmony_ci// b. If abs(base) = 1, return NaN.
1024514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
1034514f5e3Sopenharmony_cilen = Math.pow(1, +Infinity);
1044514f5e3Sopenharmony_ciprint(len); //: NaN
1054514f5e3Sopenharmony_ci// c. If abs(base) < 1, return +inf.
1064514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
1074514f5e3Sopenharmony_cilen = Math.pow(0.5, +Infinity);
1084514f5e3Sopenharmony_ciprint(len); //: 0
1094514f5e3Sopenharmony_ci
1104514f5e3Sopenharmony_ci// If exponent is -inf, then
1114514f5e3Sopenharmony_ci// a. If abs(base) > 1, return +inf.
1124514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
1134514f5e3Sopenharmony_cilen = Math.pow(1.5, -Infinity);
1144514f5e3Sopenharmony_ciprint(len); //: 0
1154514f5e3Sopenharmony_ci// b. If abs(base) = 1, return NaN.
1164514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
1174514f5e3Sopenharmony_cilen = Math.pow(1, -Infinity);
1184514f5e3Sopenharmony_ciprint(len); //: NaN
1194514f5e3Sopenharmony_ci// c. If abs(base) < 1, return +inf.
1204514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
1214514f5e3Sopenharmony_cilen = Math.pow(0.2, -Infinity);
1224514f5e3Sopenharmony_ciprint(len); //: Infinity
1234514f5e3Sopenharmony_ci
1244514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
1254514f5e3Sopenharmony_cilen = Math.pow(1, Infinity);
1264514f5e3Sopenharmony_ciprint(len); //: NaN
1274514f5e3Sopenharmony_ci
1284514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
1294514f5e3Sopenharmony_cilen = Math.pow(-1, Infinity);
1304514f5e3Sopenharmony_ciprint(len); //: NaN
1314514f5e3Sopenharmony_ci
1324514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
1334514f5e3Sopenharmony_cilen = Math.pow(1, -Infinity);
1344514f5e3Sopenharmony_ciprint(len); //: NaN
1354514f5e3Sopenharmony_ci
1364514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
1374514f5e3Sopenharmony_cilen = Math.pow(-1, -Infinity);
1384514f5e3Sopenharmony_ciprint(len); //: NaN
1394514f5e3Sopenharmony_ci
1404514f5e3Sopenharmony_ci//aot: [trace] aot inline builtin: Math.pow, caller function name:func_main_0@builtinMathPow
1414514f5e3Sopenharmony_ci//aot: [trace] Check Type: NotNumber1
1424514f5e3Sopenharmony_cilen = Math.pow(2, "three");
1434514f5e3Sopenharmony_ciprint(len); //: NaN
144