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
74 #if (defined(SUNOS)|| defined(WIN32)|| defined(WIN2K)|| defined (SS_LINUX))
75 RETVALUE((U32) abs((int) val));/* G++ */
86 * Desc: common primitive for computing the power of x raised to y.
88 * Ret: value of x raised to the power of y.
102 PUBLIC F64 cmPow(x, y)
107 #if (defined(SUNOS)|| defined(WIN32)|| defined(WIN2K)|| defined (SS_LINUX))
108 RETVALUE((F64) pow((F64)x, (F64)y));
111 #endif /* SS_FLOAT */
118 * Desc: common primitive for computing the largest integral value
119 * not greater than x.
121 * Ret: floor value of x
134 PUBLIC F64 cmFloor(x)
138 #if (defined(SUNOS)|| defined(WIN32)|| defined(WIN2K)|| defined (SS_LINUX))
139 RETVALUE((F64) floor((F64)x));
142 } /* end of cmFloor */
143 #endif /* SS_FLOAT */
150 * Desc: common primitive for computing the natural logrithm of x.
169 #if (defined(SUNOS)|| defined(WIN32)|| defined(WIN2K)|| defined (SS_LINUX))
170 RETVALUE((F64) log((F64)x));
174 #endif /* SS_FLOAT */
181 * Desc: common primitive for computing the base 10 logrithm of x.
196 PUBLIC F64 cmLog10(x)
200 #if (defined(SUNOS)|| defined(WIN32)|| defined(WIN2K)|| defined (SS_LINUX))
201 RETVALUE((F64) log10((F64)x));
203 } /* end of cmLog10 */
204 #endif /* SS_FLOAT */
206 /**********************************************************************
208 **********************************************************************/