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; 17function replace(a : number) 18{ 19 return a; 20} 21 22let len:number = 1; 23 24// Check without params 25len = Math.atan2(); 26//aot: [trace] aot inline builtin: Math.atan2, caller function name:func_main_0@builtinMathAtan2 27print(len); //: NaN 28 29len = Math.atan2(NaN); 30//aot: [trace] aot inline builtin: Math.atan2, caller function name:func_main_0@builtinMathAtan2 31print(len); //: NaN 32 33len = Math.atan2(NaN, NaN); 34//aot: [trace] aot inline builtin: Math.atan2, caller function name:func_main_0@builtinMathAtan2 35print(len); //: NaN 36 37len = Math.atan2(0, NaN); 38//aot: [trace] aot inline builtin: Math.atan2, caller function name:func_main_0@builtinMathAtan2 39print(len); //: NaN 40 41len = Math.atan2(NaN, 0); 42//aot: [trace] aot inline builtin: Math.atan2, caller function name:func_main_0@builtinMathAtan2 43print(len); //: NaN 44 45len = Math.atan2(-1, 1.5); 46//aot: [trace] aot inline builtin: Math.atan2, caller function name:func_main_0@builtinMathAtan2 47print(len); //: -0.5880026035475675 48 49len = Math.atan2(1, -0); // PI/2 50//aot: [trace] aot inline builtin: Math.atan2, caller function name:func_main_0@builtinMathAtan2 51print(len); //: 1.5707963267948966 52 53len = Math.atan2(0, 1); 54//aot: [trace] aot inline builtin: Math.atan2, caller function name:func_main_0@builtinMathAtan2 55print(len); //: 0 56 57len = Math.atan2(0, -0); // PI 58//aot: [trace] aot inline builtin: Math.atan2, caller function name:func_main_0@builtinMathAtan2 59print(len); //: 3.141592653589793 60 61len = Math.atan2(-0, 0); 62//aot: [trace] aot inline builtin: Math.atan2, caller function name:func_main_0@builtinMathAtan2 63print("1/x: " + 1/len); //: 1/x: -Infinity 64 65len = Math.atan2(-0, -0); // -PI 66//aot: [trace] aot inline builtin: Math.atan2, caller function name:func_main_0@builtinMathAtan2 67print(len); //: -3.141592653589793 68 69len = Math.atan2(-1, Number.POSITIVE_INFINITY) 70//aot: [trace] aot inline builtin: Math.atan2, caller function name:func_main_0@builtinMathAtan2 71print("1/x: " + 1/len) //: 1/x: -Infinity 72 73len = Math.atan2(1, Number.POSITIVE_INFINITY) 74//aot: [trace] aot inline builtin: Math.atan2, caller function name:func_main_0@builtinMathAtan2 75print(len) //: 0 76 77// Replace standart builtin 78let true_atan2 = Math.atan2 79Math.atan2 = replace 80len = Math.atan2(111); 81print(len); //: 111 82 83// Call standart builtin with non-number param 84Math.atan2 = true_atan2 85len = Math.atan2(0, "NaN"); // deopt 86//aot: [trace] aot inline builtin: Math.atan2, caller function name:func_main_0@builtinMathAtan2 87//aot: [trace] Check Type: NotNumber1 88print(len); //: NaN 89