1 /*******************************************************************************
2 ################################################################################
3 # Copyright (c) [2017-2019] [Radisys] #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you may not use this file except in compliance with the License. #
7 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, #
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ################################################################################
17 *******************************************************************************/
20 /********************************************************************20**
22 Name: common MATH library functions
26 Desc: Common functions that are implemented in
27 a portable manner. These functions are selected
28 based on the operating system.
32 *********************************************************************21*/
35 /* header include files (.h) */
36 #include "envopt.h" /* environment options */
37 #include "envdep.h" /* environment dependent */
38 #include "envind.h" /* environment independent */
39 #include "gen.h" /* general */
40 #include "ssi.h" /* system services interface */
55 * Desc: common primitive for an absolute value of an integer
57 * Ret: absolute value of the operand
64 uint32_t cmAbs(F64 val)
66 #if (defined(SUNOS)|| defined(WIN32)|| defined(WIN2K)|| defined (SS_LINUX))
67 return ((uint32_t) abs((int) val));/* G++ */
78 * Desc: common primitive for computing the power of x raised to y.
80 * Ret: value of x raised to the power of y.
87 F64 cmPow(F64 x,F64 y)
89 #if (defined(SUNOS)|| defined(WIN32)|| defined(WIN2K)|| defined (SS_LINUX))
90 return ((F64) pow((F64)x, (F64)y));
100 * Desc: common primitive for computing the largest integral value
101 * not greater than x.
103 * Ret: floor value of x
112 #if (defined(SUNOS)|| defined(WIN32)|| defined(WIN2K)|| defined (SS_LINUX))
113 return ((F64) floor((F64)x));
116 } /* end of cmFloor */
117 #endif /* SS_FLOAT */
124 * Desc: common primitive for computing the natural logrithm of x.
135 #if (defined(SUNOS)|| defined(WIN32)|| defined(WIN2K)|| defined (SS_LINUX))
136 return ((F64) log((F64)x));
140 #endif /* SS_FLOAT */
147 * Desc: common primitive for computing the base 10 logrithm of x.
158 #if (defined(SUNOS)|| defined(WIN32)|| defined(WIN2K)|| defined (SS_LINUX))
159 return ((F64) log10((F64)x));
161 } /* end of cmLog10 */
162 #endif /* SS_FLOAT */
164 /**********************************************************************
166 **********************************************************************/