modernc.org/cc@v1.0.1/v2/headers/linux_386/usr/include/i386-linux-gnu/bits/mathcalls.h (about) 1 /* Prototype declarations for math functions; helper file for <math.h>. 2 Copyright (C) 1996-2018 Free Software Foundation, Inc. 3 This file is part of the GNU C Library. 4 5 The GNU C Library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License as published by the Free Software Foundation; either 8 version 2.1 of the License, or (at your option) any later version. 9 10 The GNU C Library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with the GNU C Library; if not, see 17 <http://www.gnu.org/licenses/>. */ 18 19 /* NOTE: Because of the special way this file is used by <math.h>, this 20 file must NOT be protected from multiple inclusion as header files 21 usually are. 22 23 This file provides prototype declarations for the math functions. 24 Most functions are declared using the macro: 25 26 __MATHCALL (NAME,[_r], (ARGS...)); 27 28 This means there is a function `NAME' returning `double' and a function 29 `NAMEf' returning `float'. Each place `_Mdouble_' appears in the 30 prototype, that is actually `double' in the prototype for `NAME' and 31 `float' in the prototype for `NAMEf'. Reentrant variant functions are 32 called `NAME_r' and `NAMEf_r'. 33 34 Functions returning other types like `int' are declared using the macro: 35 36 __MATHDECL (TYPE, NAME,[_r], (ARGS...)); 37 38 This is just like __MATHCALL but for a function returning `TYPE' 39 instead of `_Mdouble_'. In all of these cases, there is still 40 both a `NAME' and a `NAMEf' that takes `float' arguments. 41 42 Note that there must be no whitespace before the argument passed for 43 NAME, to make token pasting work with -traditional. */ 44 45 #ifndef _MATH_H 46 # error "Never include <bits/mathcalls.h> directly; include <math.h> instead." 47 #endif 48 49 /* Trigonometric functions. */ 50 51 /* Arc cosine of X. */ 52 __MATHCALL(acos,, (_Mdouble_ __x)); 53 /* Arc sine of X. */ 54 __MATHCALL(asin,, (_Mdouble_ __x)); 55 /* Arc tangent of X. */ 56 __MATHCALL(atan,, (_Mdouble_ __x)); 57 /* Arc tangent of Y/X. */ 58 __MATHCALL(atan2,, (_Mdouble_ __y, _Mdouble_ __x)); 59 60 /* Cosine of X. */ 61 __MATHCALL_VEC(cos,, (_Mdouble_ __x)); 62 /* Sine of X. */ 63 __MATHCALL_VEC(sin,, (_Mdouble_ __x)); 64 /* Tangent of X. */ 65 __MATHCALL(tan,, (_Mdouble_ __x)); 66 67 /* Hyperbolic functions. */ 68 69 /* Hyperbolic cosine of X. */ 70 __MATHCALL(cosh,, (_Mdouble_ __x)); 71 /* Hyperbolic sine of X. */ 72 __MATHCALL(sinh,, (_Mdouble_ __x)); 73 /* Hyperbolic tangent of X. */ 74 __MATHCALL(tanh,, (_Mdouble_ __x)); 75 76 #ifdef __USE_GNU 77 /* Cosine and sine of X. */ 78 __MATHDECL_VEC(void, sincos,, (_Mdouble_ __x, _Mdouble_ * __sinx, _Mdouble_ * __cosx)); 79 #endif 80 81 #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 82 /* Hyperbolic arc cosine of X. */ 83 __MATHCALL(acosh,, (_Mdouble_ __x)); 84 /* Hyperbolic arc sine of X. */ 85 __MATHCALL(asinh,, (_Mdouble_ __x)); 86 /* Hyperbolic arc tangent of X. */ 87 __MATHCALL(atanh,, (_Mdouble_ __x)); 88 #endif 89 90 /* Exponential and logarithmic functions. */ 91 92 /* Exponential function of X. */ 93 __MATHCALL_VEC(exp,, (_Mdouble_ __x)); 94 95 /* Break VALUE into a normalized fraction and an integral power of 2. */ 96 __MATHCALL(frexp,, (_Mdouble_ __x, int *__exponent)); 97 98 /* X times (two to the EXP power). */ 99 __MATHCALL(ldexp,, (_Mdouble_ __x, int __exponent)); 100 101 /* Natural logarithm of X. */ 102 __MATHCALL_VEC(log,, (_Mdouble_ __x)); 103 104 /* Base-ten logarithm of X. */ 105 __MATHCALL(log10,, (_Mdouble_ __x)); 106 107 /* Break VALUE into integral and fractional parts. */ 108 __MATHCALL(modf,, (_Mdouble_ __x, _Mdouble_ * __iptr)) __nonnull((2)); 109 110 #if __GLIBC_USE (IEC_60559_FUNCS_EXT) 111 /* Compute exponent to base ten. */ 112 __MATHCALL(exp10,, (_Mdouble_ __x)); 113 #endif 114 115 #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 116 /* Return exp(X) - 1. */ 117 __MATHCALL(expm1,, (_Mdouble_ __x)); 118 119 /* Return log(1 + X). */ 120 __MATHCALL(log1p,, (_Mdouble_ __x)); 121 122 /* Return the base 2 signed integral exponent of X. */ 123 __MATHCALL(logb,, (_Mdouble_ __x)); 124 #endif 125 126 #ifdef __USE_ISOC99 127 /* Compute base-2 exponential of X. */ 128 __MATHCALL(exp2,, (_Mdouble_ __x)); 129 130 /* Compute base-2 logarithm of X. */ 131 __MATHCALL(log2,, (_Mdouble_ __x)); 132 #endif 133 134 /* Power functions. */ 135 136 /* Return X to the Y power. */ 137 __MATHCALL_VEC(pow,, (_Mdouble_ __x, _Mdouble_ __y)); 138 139 /* Return the square root of X. */ 140 __MATHCALL(sqrt,, (_Mdouble_ __x)); 141 142 #if defined __USE_XOPEN || defined __USE_ISOC99 143 /* Return `sqrt(X*X + Y*Y)'. */ 144 __MATHCALL(hypot,, (_Mdouble_ __x, _Mdouble_ __y)); 145 #endif 146 147 #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 148 /* Return the cube root of X. */ 149 __MATHCALL(cbrt,, (_Mdouble_ __x)); 150 #endif 151 152 /* Nearest integer, absolute value, and remainder functions. */ 153 154 /* Smallest integral value not less than X. */ 155 __MATHCALLX(ceil,, (_Mdouble_ __x), (__const__)); 156 157 /* Absolute value of X. */ 158 __MATHCALLX(fabs,, (_Mdouble_ __x), (__const__)); 159 160 /* Largest integer not greater than X. */ 161 __MATHCALLX(floor,, (_Mdouble_ __x), (__const__)); 162 163 /* Floating-point modulo remainder of X/Y. */ 164 __MATHCALL(fmod,, (_Mdouble_ __x, _Mdouble_ __y)); 165 166 #ifdef __USE_MISC 167 # if ((!defined __cplusplus \ 168 || __cplusplus < 201103L /* isinf conflicts with C++11. */ \ 169 || __MATH_DECLARING_DOUBLE == 0)) /* isinff or isinfl don't. */ \ 170 && !__MATH_DECLARING_FLOATN 171 /* Return 0 if VALUE is finite or NaN, +1 if it 172 is +Infinity, -1 if it is -Infinity. */ 173 __MATHDECL_1(int, isinf,, (_Mdouble_ __value)) __attribute__ ((__const__)); 174 # endif 175 176 # if !__MATH_DECLARING_FLOATN 177 /* Return nonzero if VALUE is finite and not NaN. */ 178 __MATHDECL_1(int, finite,, (_Mdouble_ __value)) __attribute__ ((__const__)); 179 180 /* Return the remainder of X/Y. */ 181 __MATHCALL(drem,, (_Mdouble_ __x, _Mdouble_ __y)); 182 183 /* Return the fractional part of X after dividing out `ilogb (X)'. */ 184 __MATHCALL(significand,, (_Mdouble_ __x)); 185 # endif 186 187 #endif /* Use misc. */ 188 189 #ifdef __USE_ISOC99 190 /* Return X with its signed changed to Y's. */ 191 __MATHCALLX(copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); 192 #endif 193 194 #ifdef __USE_ISOC99 195 /* Return representation of qNaN for double type. */ 196 __MATHCALLX(nan,, (const char *__tagb), (__const__)); 197 #endif 198 199 #if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K) 200 # if ((!defined __cplusplus \ 201 || __cplusplus < 201103L /* isnan conflicts with C++11. */ \ 202 || __MATH_DECLARING_DOUBLE == 0)) /* isnanf or isnanl don't. */ \ 203 && !__MATH_DECLARING_FLOATN 204 /* Return nonzero if VALUE is not a number. */ 205 __MATHDECL_1(int, isnan,, (_Mdouble_ __value)) __attribute__ ((__const__)); 206 # endif 207 #endif 208 209 #if defined __USE_MISC || (defined __USE_XOPEN && __MATH_DECLARING_DOUBLE) 210 /* Bessel functions. */ 211 __MATHCALL(j0,, (_Mdouble_)); 212 __MATHCALL(j1,, (_Mdouble_)); 213 __MATHCALL(jn,, (int, _Mdouble_)); 214 __MATHCALL(y0,, (_Mdouble_)); 215 __MATHCALL(y1,, (_Mdouble_)); 216 __MATHCALL(yn,, (int, _Mdouble_)); 217 #endif 218 219 #if defined __USE_XOPEN || defined __USE_ISOC99 220 /* Error and gamma functions. */ 221 __MATHCALL(erf,, (_Mdouble_)); 222 __MATHCALL(erfc,, (_Mdouble_)); 223 __MATHCALL(lgamma,, (_Mdouble_)); 224 #endif 225 226 #ifdef __USE_ISOC99 227 /* True gamma function. */ 228 __MATHCALL(tgamma,, (_Mdouble_)); 229 #endif 230 231 #if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K) 232 # if !__MATH_DECLARING_FLOATN 233 /* Obsolete alias for `lgamma'. */ 234 __MATHCALL(gamma,, (_Mdouble_)); 235 # endif 236 #endif 237 238 #ifdef __USE_MISC 239 /* Reentrant version of lgamma. This function uses the global variable 240 `signgam'. The reentrant version instead takes a pointer and stores 241 the value through it. */ 242 __MATHCALL(lgamma, _r, (_Mdouble_, int *__signgamp)); 243 #endif 244 245 #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 246 /* Return the integer nearest X in the direction of the 247 prevailing rounding mode. */ 248 __MATHCALL(rint,, (_Mdouble_ __x)); 249 250 /* Return X + epsilon if X < Y, X - epsilon if X > Y. */ 251 __MATHCALL(nextafter,, (_Mdouble_ __x, _Mdouble_ __y)); 252 # if defined __USE_ISOC99 && !defined __LDBL_COMPAT && !__MATH_DECLARING_FLOATN 253 __MATHCALL(nexttoward,, (_Mdouble_ __x, long double __y)); 254 # endif 255 256 # if __GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN 257 /* Return X - epsilon. */ 258 __MATHCALL(nextdown,, (_Mdouble_ __x)); 259 /* Return X + epsilon. */ 260 __MATHCALL(nextup,, (_Mdouble_ __x)); 261 # endif 262 263 /* Return the remainder of integer divison X / Y with infinite precision. */ 264 __MATHCALL(remainder,, (_Mdouble_ __x, _Mdouble_ __y)); 265 266 # ifdef __USE_ISOC99 267 /* Return X times (2 to the Nth power). */ 268 __MATHCALL(scalbn,, (_Mdouble_ __x, int __n)); 269 # endif 270 271 /* Return the binary exponent of X, which must be nonzero. */ 272 __MATHDECL(int, ilogb,, (_Mdouble_ __x)); 273 #endif 274 275 #if __GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN 276 /* Like ilogb, but returning long int. */ 277 __MATHDECL(long int, llogb,, (_Mdouble_ __x)); 278 #endif 279 280 #ifdef __USE_ISOC99 281 /* Return X times (2 to the Nth power). */ 282 __MATHCALL(scalbln,, (_Mdouble_ __x, long int __n)); 283 284 /* Round X to integral value in floating-point format using current 285 rounding direction, but do not raise inexact exception. */ 286 __MATHCALL(nearbyint,, (_Mdouble_ __x)); 287 288 /* Round X to nearest integral value, rounding halfway cases away from 289 zero. */ 290 __MATHCALLX(round,, (_Mdouble_ __x), (__const__)); 291 292 /* Round X to the integral value in floating-point format nearest but 293 not larger in magnitude. */ 294 __MATHCALLX(trunc,, (_Mdouble_ __x), (__const__)); 295 296 /* Compute remainder of X and Y and put in *QUO a value with sign of x/y 297 and magnitude congruent `mod 2^n' to the magnitude of the integral 298 quotient x/y, with n >= 3. */ 299 __MATHCALL(remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo)); 300 301 /* Conversion functions. */ 302 303 /* Round X to nearest integral value according to current rounding 304 direction. */ 305 __MATHDECL(long int, lrint,, (_Mdouble_ __x)); 306 __extension__ __MATHDECL(long long int, llrint,, (_Mdouble_ __x)); 307 308 /* Round X to nearest integral value, rounding halfway cases away from 309 zero. */ 310 __MATHDECL(long int, lround,, (_Mdouble_ __x)); 311 __extension__ __MATHDECL(long long int, llround,, (_Mdouble_ __x)); 312 313 /* Return positive difference between X and Y. */ 314 __MATHCALL(fdim,, (_Mdouble_ __x, _Mdouble_ __y)); 315 316 /* Return maximum numeric value from X and Y. */ 317 __MATHCALLX(fmax,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); 318 319 /* Return minimum numeric value from X and Y. */ 320 __MATHCALLX(fmin,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); 321 322 /* Multiply-add function computed as a ternary operation. */ 323 __MATHCALL(fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z)); 324 #endif /* Use ISO C99. */ 325 326 #if __GLIBC_USE (IEC_60559_BFP_EXT) || __MATH_DECLARING_FLOATN 327 /* Round X to nearest integer value, rounding halfway cases to even. */ 328 __MATHCALLX(roundeven,, (_Mdouble_ __x), (__const__)); 329 330 /* Round X to nearest signed integer value, not raising inexact, with 331 control of rounding direction and width of result. */ 332 __MATHDECL(__intmax_t, fromfp,, (_Mdouble_ __x, int __round, unsigned int __width)); 333 334 /* Round X to nearest unsigned integer value, not raising inexact, 335 with control of rounding direction and width of result. */ 336 __MATHDECL(__uintmax_t, ufromfp,, (_Mdouble_ __x, int __round, unsigned int __width)); 337 338 /* Round X to nearest signed integer value, raising inexact for 339 non-integers, with control of rounding direction and width of 340 result. */ 341 __MATHDECL(__intmax_t, fromfpx,, (_Mdouble_ __x, int __round, unsigned int __width)); 342 343 /* Round X to nearest unsigned integer value, raising inexact for 344 non-integers, with control of rounding direction and width of 345 result. */ 346 __MATHDECL(__uintmax_t, ufromfpx,, (_Mdouble_ __x, int __round, unsigned int __width)); 347 348 /* Return value with maximum magnitude. */ 349 __MATHCALLX(fmaxmag,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); 350 351 /* Return value with minimum magnitude. */ 352 __MATHCALLX(fminmag,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); 353 354 /* Total order operation. */ 355 __MATHDECL_1(int, totalorder,, (_Mdouble_ __x, _Mdouble_ __y)) 356 __attribute__ ((__const__)); 357 358 /* Total order operation on absolute values. */ 359 __MATHDECL_1(int, totalordermag,, (_Mdouble_ __x, _Mdouble_ __y)) 360 __attribute__ ((__const__)); 361 362 /* Canonicalize floating-point representation. */ 363 __MATHDECL_1(int, canonicalize,, (_Mdouble_ * __cx, const _Mdouble_ * __x)); 364 365 /* Get NaN payload. */ 366 __MATHCALL(getpayload,, (const _Mdouble_ * __x)); 367 368 /* Set quiet NaN payload. */ 369 __MATHDECL_1(int, setpayload,, (_Mdouble_ * __x, _Mdouble_ __payload)); 370 371 /* Set signaling NaN payload. */ 372 __MATHDECL_1(int, setpayloadsig,, (_Mdouble_ * __x, _Mdouble_ __payload)); 373 #endif 374 375 #if (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \ 376 && __MATH_DECLARING_DOUBLE \ 377 && !defined __USE_XOPEN2K8)) \ 378 && !__MATH_DECLARING_FLOATN 379 /* Return X times (2 to the Nth power). */ 380 __MATHCALL(scalb,, (_Mdouble_ __x, _Mdouble_ __n)); 381 #endif