1/* Prototype declarations for math functions; helper file for <math.h>. 2 Copyright (C) 1996-2002, 2003, 2006, 2011 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, write to the Free 17 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 18 02111-1307 USA. */ 19 20/* NOTE: Because of the special way this file is used by <math.h>, this 21 file must NOT be protected from multiple inclusion as header files 22 usually are. 23 24 This file provides prototype declarations for the math functions. 25 Most functions are declared using the macro: 26 27 __MATHCALL (NAME,[_r], (ARGS...)); 28 29 This means there is a function `NAME' returning `double' and a function 30 `NAMEf' returning `float'. Each place `_Mdouble_' appears in the 31 prototype, that is actually `double' in the prototype for `NAME' and 32 `float' in the prototype for `NAMEf'. Reentrant variant functions are 33 called `NAME_r' and `NAMEf_r'. 34 35 Functions returning other types like `int' are declared using the macro: 36 37 __MATHDECL (TYPE, NAME,[_r], (ARGS...)); 38 39 This is just like __MATHCALL but for a function returning `TYPE' 40 instead of `_Mdouble_'. In all of these cases, there is still 41 both a `NAME' and a `NAMEf' that takes `float' arguments. 42 43 Note that there must be no whitespace before the argument passed for 44 NAME, to make token pasting work with -traditional. */ 45 46#ifndef _MATH_H 47# error "Never include <bits/mathcalls.h> directly; include <math.h> instead." 48#endif 49 50 51/* Trigonometric functions. */ 52 53_Mdouble_BEGIN_NAMESPACE 54/* Arc cosine of X. */ 55__MATHCALL (acos,, (_Mdouble_ __x)); 56/* Arc sine of X. */ 57__MATHCALL (asin,, (_Mdouble_ __x)); 58/* Arc tangent of X. */ 59__MATHCALL (atan,, (_Mdouble_ __x)); 60/* Arc tangent of Y/X. */ 61__MATHCALL (atan2,, (_Mdouble_ __y, _Mdouble_ __x)); 62 63/* Cosine of X. */ 64__MATHCALL (cos,, (_Mdouble_ __x)); 65/* Sine of X. */ 66__MATHCALL (sin,, (_Mdouble_ __x)); 67/* Tangent of X. */ 68__MATHCALL (tan,, (_Mdouble_ __x)); 69 70/* Hyperbolic functions. */ 71 72/* Hyperbolic cosine of X. */ 73__MATHCALL (cosh,, (_Mdouble_ __x)); 74/* Hyperbolic sine of X. */ 75__MATHCALL (sinh,, (_Mdouble_ __x)); 76/* Hyperbolic tangent of X. */ 77__MATHCALL (tanh,, (_Mdouble_ __x)); 78_Mdouble_END_NAMESPACE 79 80#ifdef __USE_GNU 81/* Cosine and sine of X. */ 82__MATHDECL (void,sincos,, 83 (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx)); 84#endif 85 86#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 87__BEGIN_NAMESPACE_C99 88/* Hyperbolic arc cosine of X. */ 89__MATHCALL (acosh,, (_Mdouble_ __x)); 90/* Hyperbolic arc sine of X. */ 91__MATHCALL (asinh,, (_Mdouble_ __x)); 92/* Hyperbolic arc tangent of X. */ 93__MATHCALL (atanh,, (_Mdouble_ __x)); 94__END_NAMESPACE_C99 95#endif 96 97/* Exponential and logarithmic functions. */ 98 99_Mdouble_BEGIN_NAMESPACE 100/* Exponential function of X. */ 101__MATHCALL (exp,, (_Mdouble_ __x)); 102 103/* Break VALUE into a normalized fraction and an integral power of 2. */ 104__MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent)); 105 106/* X times (two to the EXP power). */ 107__MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent)); 108 109/* Natural logarithm of X. */ 110__MATHCALL (log,, (_Mdouble_ __x)); 111 112/* Base-ten logarithm of X. */ 113__MATHCALL (log10,, (_Mdouble_ __x)); 114 115/* Break VALUE into integral and fractional parts. */ 116__MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)) 117 __attribute__ ((__nonnull__ (2))); 118_Mdouble_END_NAMESPACE 119 120#ifdef __USE_GNU 121/* A function missing in all standards: compute exponent to base ten. */ 122__MATHCALL (exp10,, (_Mdouble_ __x)); 123/* Another name occasionally used. */ 124__MATHCALL (pow10,, (_Mdouble_ __x)); 125#endif 126 127#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 128__BEGIN_NAMESPACE_C99 129/* Return exp(X) - 1. */ 130__MATHCALL (expm1,, (_Mdouble_ __x)); 131 132/* Return log(1 + X). */ 133__MATHCALL (log1p,, (_Mdouble_ __x)); 134 135/* Return the base 2 signed integral exponent of X. */ 136__MATHCALL (logb,, (_Mdouble_ __x)); 137__END_NAMESPACE_C99 138#endif 139 140#ifdef __USE_ISOC99 141__BEGIN_NAMESPACE_C99 142/* Compute base-2 exponential of X. */ 143__MATHCALL (exp2,, (_Mdouble_ __x)); 144 145/* Compute base-2 logarithm of X. */ 146__MATHCALL (log2,, (_Mdouble_ __x)); 147__END_NAMESPACE_C99 148#endif 149 150 151/* Power functions. */ 152 153_Mdouble_BEGIN_NAMESPACE 154/* Return X to the Y power. */ 155__MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y)); 156 157/* Return the square root of X. */ 158__MATHCALL (sqrt,, (_Mdouble_ __x)); 159_Mdouble_END_NAMESPACE 160 161#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99 162__BEGIN_NAMESPACE_C99 163/* Return `sqrt(X*X + Y*Y)'. */ 164__MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y)); 165__END_NAMESPACE_C99 166#endif 167 168#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 169__BEGIN_NAMESPACE_C99 170/* Return the cube root of X. */ 171__MATHCALL (cbrt,, (_Mdouble_ __x)); 172__END_NAMESPACE_C99 173#endif 174 175 176/* Nearest integer, absolute value, and remainder functions. */ 177 178_Mdouble_BEGIN_NAMESPACE 179/* Smallest integral value not less than X. */ 180__MATHCALLX (ceil,, (_Mdouble_ __x), (__const__)); 181 182/* Absolute value of X. */ 183__MATHCALLX (fabs,, (_Mdouble_ __x), (__const__)); 184 185/* Largest integer not greater than X. */ 186__MATHCALLX (floor,, (_Mdouble_ __x), (__const__)); 187 188/* Floating-point modulo remainder of X/Y. */ 189__MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y)); 190 191 192/* Return 0 if VALUE is finite or NaN, +1 if it 193 is +Infinity, -1 if it is -Infinity. */ 194__MATHDECL_1 (int,__isinf,, (_Mdouble_ __value)) __attribute__ ((__const__)); 195 196/* Return nonzero if VALUE is finite and not NaN. */ 197__MATHDECL_1 (int,__finite,, (_Mdouble_ __value)) __attribute__ ((__const__)); 198_Mdouble_END_NAMESPACE 199 200#ifdef __USE_MISC 201/* Return 0 if VALUE is finite or NaN, +1 if it 202 is +Infinity, -1 if it is -Infinity. */ 203__MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__)); 204 205/* Return nonzero if VALUE is finite and not NaN. */ 206__MATHDECL_1 (int,finite,, (_Mdouble_ __value)) __attribute__ ((__const__)); 207 208/* Return the remainder of X/Y. */ 209__MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y)); 210 211 212/* Return the fractional part of X after dividing out `ilogb (X)'. */ 213__MATHCALL (significand,, (_Mdouble_ __x)); 214#endif /* Use misc. */ 215 216#if defined __USE_MISC || defined __USE_ISOC99 217__BEGIN_NAMESPACE_C99 218/* Return X with its signed changed to Y's. */ 219__MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); 220__END_NAMESPACE_C99 221#endif 222 223#ifdef __USE_ISOC99 224__BEGIN_NAMESPACE_C99 225/* Return representation of NaN for double type. */ 226__MATHCALLX (nan,, (__const char *__tagb), (__const__)); 227__END_NAMESPACE_C99 228#endif 229 230 231/* Return nonzero if VALUE is not a number. */ 232__MATHDECL_1 (int,__isnan,, (_Mdouble_ __value)) __attribute__ ((__const__)); 233 234#if defined __USE_MISC || defined __USE_XOPEN 235/* Return nonzero if VALUE is not a number. */ 236__MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__)); 237 238/* Bessel functions. */ 239__MATHCALL (j0,, (_Mdouble_)); 240__MATHCALL (j1,, (_Mdouble_)); 241__MATHCALL (jn,, (int, _Mdouble_)); 242__MATHCALL (y0,, (_Mdouble_)); 243__MATHCALL (y1,, (_Mdouble_)); 244__MATHCALL (yn,, (int, _Mdouble_)); 245#endif 246 247 248#if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99 249__BEGIN_NAMESPACE_C99 250/* Error and gamma functions. */ 251__MATHCALL (erf,, (_Mdouble_)); 252__MATHCALL (erfc,, (_Mdouble_)); 253__MATHCALL (lgamma,, (_Mdouble_)); 254__END_NAMESPACE_C99 255#endif 256 257#ifdef __USE_ISOC99 258__BEGIN_NAMESPACE_C99 259/* True gamma function. */ 260__MATHCALL (tgamma,, (_Mdouble_)); 261__END_NAMESPACE_C99 262#endif 263 264#if defined __USE_MISC || defined __USE_XOPEN 265/* Obsolete alias for `lgamma'. */ 266__MATHCALL (gamma,, (_Mdouble_)); 267#endif 268 269#ifdef __USE_MISC 270/* Reentrant version of lgamma. This function uses the global variable 271 `signgam'. The reentrant version instead takes a pointer and stores 272 the value through it. */ 273__MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp)); 274#endif 275 276 277#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 278__BEGIN_NAMESPACE_C99 279/* Return the integer nearest X in the direction of the 280 prevailing rounding mode. */ 281__MATHCALL (rint,, (_Mdouble_ __x)); 282 283/* Return X + epsilon if X < Y, X - epsilon if X > Y. */ 284__MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__)); 285# if defined __USE_ISOC99 && !defined __LDBL_COMPAT 286__MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__)); 287# endif 288 289/* Return the remainder of integer divison X / Y with infinite precision. */ 290__MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y)); 291 292# if defined __USE_MISC || defined __USE_ISOC99 293/* Return X times (2 to the Nth power). */ 294__MATHCALL (scalbn,, (_Mdouble_ __x, int __n)); 295# endif 296 297/* Return the binary exponent of X, which must be nonzero. */ 298__MATHDECL (int,ilogb,, (_Mdouble_ __x)); 299#endif 300 301#ifdef __USE_ISOC99 302/* Return X times (2 to the Nth power). */ 303__MATHCALL (scalbln,, (_Mdouble_ __x, long int __n)); 304 305/* Round X to integral value in floating-point format using current 306 rounding direction, but do not raise inexact exception. */ 307__MATHCALL (nearbyint,, (_Mdouble_ __x)); 308 309/* Round X to nearest integral value, rounding halfway cases away from 310 zero. */ 311__MATHCALLX (round,, (_Mdouble_ __x), (__const__)); 312 313/* Round X to the integral value in floating-point format nearest but 314 not larger in magnitude. */ 315__MATHCALLX (trunc,, (_Mdouble_ __x), (__const__)); 316 317/* Compute remainder of X and Y and put in *QUO a value with sign of x/y 318 and magnitude congruent `mod 2^n' to the magnitude of the integral 319 quotient x/y, with n >= 3. */ 320__MATHCALL (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo)); 321 322 323/* Conversion functions. */ 324 325/* Round X to nearest integral value according to current rounding 326 direction. */ 327__MATHDECL (long int,lrint,, (_Mdouble_ __x)); 328__MATHDECL (long long int,llrint,, (_Mdouble_ __x)); 329 330/* Round X to nearest integral value, rounding halfway cases away from 331 zero. */ 332__MATHDECL (long int,lround,, (_Mdouble_ __x)); 333__MATHDECL (long long int,llround,, (_Mdouble_ __x)); 334 335 336/* Return positive difference between X and Y. */ 337__MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y)); 338 339/* Return maximum numeric value from X and Y. */ 340__MATHCALL (fmax,, (_Mdouble_ __x, _Mdouble_ __y)); 341 342/* Return minimum numeric value from X and Y. */ 343__MATHCALL (fmin,, (_Mdouble_ __x, _Mdouble_ __y)); 344 345 346/* Classify given number. */ 347__MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value)) 348 __attribute__ ((__const__)); 349 350/* Test for negative number. */ 351__MATHDECL_1 (int, __signbit,, (_Mdouble_ __value)) 352 __attribute__ ((__const__)); 353 354 355/* Multiply-add function computed as a ternary operation. */ 356__MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z)); 357#endif /* Use ISO C99. */ 358 359#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99 360__END_NAMESPACE_C99 361#endif 362 363#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED 364/* Return X times (2 to the Nth power). */ 365__MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n)); 366#endif 367