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