1 /****************************************************************************** 2 * $Id: AKFS_Math.h 580 2012-03-29 09:56:21Z yamada.rj $ 3 ****************************************************************************** 4 * 5 * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan 6 * 7 * Licensed under the Apache License, Version 2.0 (the "License"); 8 * you may not use this file except in compliance with the License. 9 * You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, software 14 * distributed under the License is distributed on an "AS IS" BASIS, 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 * See the License for the specific language governing permissions and 17 * limitations under the License. 18 */ 19 #ifndef AKFS_INC_MATH_H 20 #define AKFS_INC_MATH_H 21 22 #include <math.h> 23 #include "AKFS_Configure.h" 24 25 /***** Constant definition ****************************************************/ 26 #define AKFS_PI 3.141592654f 27 #define RAD2DEG(rad) ((rad)*180.0f/AKFS_PI) 28 29 /***** Macro definition *******************************************************/ 30 31 #ifdef AKFS_PRECISION_DOUBLE 32 #define AKFS_SIN(x) sin(x) 33 #define AKFS_COS(x) cos(x) 34 #define AKFS_ASIN(x) asin(x) 35 #define AKFS_ACOS(x) acos(x) 36 #define AKFS_ATAN2(y, x) atan2((y), (x)) 37 #define AKFS_SQRT(x) sqrt(x) 38 #else 39 #define AKFS_SIN(x) sinf(x) 40 #define AKFS_COS(x) cosf(x) 41 #define AKFS_ASIN(x) asinf(x) 42 #define AKFS_ACOS(x) acosf(x) 43 #define AKFS_ATAN2(y, x) atan2f((y), (x)) 44 #define AKFS_SQRT(x) sqrtf(x) 45 #endif 46 47 #endif 48 49