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 25//aot: [trace] aot inline builtin: Math.tan, caller function name:func_main_0@builtinMathTan 26len = Math.tan(); 27print(len); //: NaN 28 29//aot: [trace] aot inline builtin: Math.tan, caller function name:func_main_0@builtinMathTan 30len = Math.tan(NaN); 31print(len); //: NaN 32 33// Check with single param 34//aot: [trace] aot inline builtin: Math.tan, caller function name:func_main_0@builtinMathTan 35len = Math.tan(0); 36print(len); //: 0 37 38// Check with single param 39//aot: [trace] aot inline builtin: Math.tan, caller function name:func_main_0@builtinMathTan 40len = Math.tan(-1); 41print(len); //: -1.5574077246549023 42 43// Check with single param 44//aot: [trace] aot inline builtin: Math.tan, caller function name:func_main_0@builtinMathTan 45len = Math.tan(1); 46print(len); //: 1.5574077246549023 47 48// Check with single param 49//aot: [trace] aot inline builtin: Math.tan, caller function name:func_main_0@builtinMathTan 50len = Math.tan(Math.PI / 10); 51print(len); //: 0.3249196962329063 52 53// Check with single param 54//aot: [trace] aot inline builtin: Math.tan, caller function name:func_main_0@builtinMathTan 55len = Math.tan(10); 56print(len); //: 0.6483608274590866 57 58// Replace standart builtin 59let true_tan = Math.tan 60Math.tan = replace 61len = Math.tan(111); 62print(len); //: 111 63 64// Call standart builtin with non-number param 65Math.tan = true_tan 66//aot: [trace] aot inline builtin: Math.tan, caller function name:func_main_0@builtinMathTan 67//aot: [trace] Check Type: NotNumber1 68len = Math.tan("NaN"); // deopt 69print(len); //: NaN 70