Back to index

glibc  2.9
mathcalls.h
Go to the documentation of this file.
00001 /* Prototype declarations for math functions; helper file for <math.h>.
00002    Copyright (C) 1996-2002, 2003, 2006 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 /* NOTE: Because of the special way this file is used by <math.h>, this
00021    file must NOT be protected from multiple inclusion as header files
00022    usually are.
00023 
00024    This file provides prototype declarations for the math functions.
00025    Most functions are declared using the macro:
00026 
00027    __MATHCALL (NAME,[_r], (ARGS...));
00028 
00029    This means there is a function `NAME' returning `double' and a function
00030    `NAMEf' returning `float'.  Each place `_Mdouble_' appears in the
00031    prototype, that is actually `double' in the prototype for `NAME' and
00032    `float' in the prototype for `NAMEf'.  Reentrant variant functions are
00033    called `NAME_r' and `NAMEf_r'.
00034 
00035    Functions returning other types like `int' are declared using the macro:
00036 
00037    __MATHDECL (TYPE, NAME,[_r], (ARGS...));
00038 
00039    This is just like __MATHCALL but for a function returning `TYPE'
00040    instead of `_Mdouble_'.  In all of these cases, there is still
00041    both a `NAME' and a `NAMEf' that takes `float' arguments.
00042 
00043    Note that there must be no whitespace before the argument passed for
00044    NAME, to make token pasting work with -traditional.  */
00045 
00046 #ifndef _MATH_H
00047 # error "Never include <bits/mathcalls.h> directly; include <math.h> instead."
00048 #endif
00049 
00050 
00051 /* Trigonometric functions.  */
00052 
00053 _Mdouble_BEGIN_NAMESPACE
00054 /* Arc cosine of X.  */
00055 __MATHCALL (acos,, (_Mdouble_ __x));
00056 /* Arc sine of X.  */
00057 __MATHCALL (asin,, (_Mdouble_ __x));
00058 /* Arc tangent of X.  */
00059 __MATHCALL (atan,, (_Mdouble_ __x));
00060 /* Arc tangent of Y/X.  */
00061 __MATHCALL (atan2,, (_Mdouble_ __y, _Mdouble_ __x));
00062 
00063 /* Cosine of X.  */
00064 __MATHCALL (cos,, (_Mdouble_ __x));
00065 /* Sine of X.  */
00066 __MATHCALL (sin,, (_Mdouble_ __x));
00067 /* Tangent of X.  */
00068 __MATHCALL (tan,, (_Mdouble_ __x));
00069 
00070 /* Hyperbolic functions.  */
00071 
00072 /* Hyperbolic cosine of X.  */
00073 __MATHCALL (cosh,, (_Mdouble_ __x));
00074 /* Hyperbolic sine of X.  */
00075 __MATHCALL (sinh,, (_Mdouble_ __x));
00076 /* Hyperbolic tangent of X.  */
00077 __MATHCALL (tanh,, (_Mdouble_ __x));
00078 _Mdouble_END_NAMESPACE
00079 
00080 #ifdef __USE_GNU
00081 /* Cosine and sine of X.  */
00082 __MATHDECL (void,sincos,,
00083            (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx));
00084 #endif
00085 
00086 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
00087 __BEGIN_NAMESPACE_C99
00088 /* Hyperbolic arc cosine of X.  */
00089 __MATHCALL (acosh,, (_Mdouble_ __x));
00090 /* Hyperbolic arc sine of X.  */
00091 __MATHCALL (asinh,, (_Mdouble_ __x));
00092 /* Hyperbolic arc tangent of X.  */
00093 __MATHCALL (atanh,, (_Mdouble_ __x));
00094 __END_NAMESPACE_C99
00095 #endif
00096 
00097 /* Exponential and logarithmic functions.  */
00098 
00099 _Mdouble_BEGIN_NAMESPACE
00100 /* Exponential function of X.  */
00101 __MATHCALL (exp,, (_Mdouble_ __x));
00102 
00103 /* Break VALUE into a normalized fraction and an integral power of 2.  */
00104 __MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent));
00105 
00106 /* X times (two to the EXP power).  */
00107 __MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent));
00108 
00109 /* Natural logarithm of X.  */
00110 __MATHCALL (log,, (_Mdouble_ __x));
00111 
00112 /* Base-ten logarithm of X.  */
00113 __MATHCALL (log10,, (_Mdouble_ __x));
00114 
00115 /* Break VALUE into integral and fractional parts.  */
00116 __MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr));
00117 _Mdouble_END_NAMESPACE
00118 
00119 #ifdef __USE_GNU
00120 /* A function missing in all standards: compute exponent to base ten.  */
00121 __MATHCALL (exp10,, (_Mdouble_ __x));
00122 /* Another name occasionally used.  */
00123 __MATHCALL (pow10,, (_Mdouble_ __x));
00124 #endif
00125 
00126 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
00127 __BEGIN_NAMESPACE_C99
00128 /* Return exp(X) - 1.  */
00129 __MATHCALL (expm1,, (_Mdouble_ __x));
00130 
00131 /* Return log(1 + X).  */
00132 __MATHCALL (log1p,, (_Mdouble_ __x));
00133 
00134 /* Return the base 2 signed integral exponent of X.  */
00135 __MATHCALL (logb,, (_Mdouble_ __x));
00136 __END_NAMESPACE_C99
00137 #endif
00138 
00139 #ifdef __USE_ISOC99
00140 __BEGIN_NAMESPACE_C99
00141 /* Compute base-2 exponential of X.  */
00142 __MATHCALL (exp2,, (_Mdouble_ __x));
00143 
00144 /* Compute base-2 logarithm of X.  */
00145 __MATHCALL (log2,, (_Mdouble_ __x));
00146 __END_NAMESPACE_C99
00147 #endif
00148 
00149 
00150 /* Power functions.  */
00151 
00152 _Mdouble_BEGIN_NAMESPACE
00153 /* Return X to the Y power.  */
00154 __MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y));
00155 
00156 /* Return the square root of X.  */
00157 __MATHCALL (sqrt,, (_Mdouble_ __x));
00158 _Mdouble_END_NAMESPACE
00159 
00160 #if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
00161 __BEGIN_NAMESPACE_C99
00162 /* Return `sqrt(X*X + Y*Y)'.  */
00163 __MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
00164 __END_NAMESPACE_C99
00165 #endif
00166 
00167 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
00168 __BEGIN_NAMESPACE_C99
00169 /* Return the cube root of X.  */
00170 __MATHCALL (cbrt,, (_Mdouble_ __x));
00171 __END_NAMESPACE_C99
00172 #endif
00173 
00174 
00175 /* Nearest integer, absolute value, and remainder functions.  */
00176 
00177 _Mdouble_BEGIN_NAMESPACE
00178 /* Smallest integral value not less than X.  */
00179 __MATHCALLX (ceil,, (_Mdouble_ __x), (__const__));
00180 
00181 /* Absolute value of X.  */
00182 __MATHCALLX (fabs,, (_Mdouble_ __x), (__const__));
00183 
00184 /* Largest integer not greater than X.  */
00185 __MATHCALLX (floor,, (_Mdouble_ __x), (__const__));
00186 
00187 /* Floating-point modulo remainder of X/Y.  */
00188 __MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
00189 
00190 
00191 /* Return 0 if VALUE is finite or NaN, +1 if it
00192    is +Infinity, -1 if it is -Infinity.  */
00193 __MATHDECL_1 (int,__isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
00194 
00195 /* Return nonzero if VALUE is finite and not NaN.  */
00196 __MATHDECL_1 (int,__finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
00197 _Mdouble_END_NAMESPACE
00198 
00199 #ifdef __USE_MISC
00200 /* Return 0 if VALUE is finite or NaN, +1 if it
00201    is +Infinity, -1 if it is -Infinity.  */
00202 __MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
00203 
00204 /* Return nonzero if VALUE is finite and not NaN.  */
00205 __MATHDECL_1 (int,finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
00206 
00207 /* Return the remainder of X/Y.  */
00208 __MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y));
00209 
00210 
00211 /* Return the fractional part of X after dividing out `ilogb (X)'.  */
00212 __MATHCALL (significand,, (_Mdouble_ __x));
00213 #endif /* Use misc.  */
00214 
00215 #if defined __USE_MISC || defined __USE_ISOC99
00216 __BEGIN_NAMESPACE_C99
00217 /* Return X with its signed changed to Y's.  */
00218 __MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
00219 __END_NAMESPACE_C99
00220 #endif
00221 
00222 #ifdef __USE_ISOC99
00223 __BEGIN_NAMESPACE_C99
00224 /* Return representation of NaN for double type.  */
00225 __MATHCALLX (nan,, (__const char *__tagb), (__const__));
00226 __END_NAMESPACE_C99
00227 #endif
00228 
00229 
00230 /* Return nonzero if VALUE is not a number.  */
00231 __MATHDECL_1 (int,__isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
00232 
00233 #if defined __USE_MISC || defined __USE_XOPEN
00234 /* Return nonzero if VALUE is not a number.  */
00235 __MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
00236 
00237 /* Bessel functions.  */
00238 __MATHCALL (j0,, (_Mdouble_));
00239 __MATHCALL (j1,, (_Mdouble_));
00240 __MATHCALL (jn,, (int, _Mdouble_));
00241 __MATHCALL (y0,, (_Mdouble_));
00242 __MATHCALL (y1,, (_Mdouble_));
00243 __MATHCALL (yn,, (int, _Mdouble_));
00244 #endif
00245 
00246 
00247 #if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
00248 __BEGIN_NAMESPACE_C99
00249 /* Error and gamma functions.  */
00250 __MATHCALL (erf,, (_Mdouble_));
00251 __MATHCALL (erfc,, (_Mdouble_));
00252 __MATHCALL (lgamma,, (_Mdouble_));
00253 __END_NAMESPACE_C99
00254 #endif
00255 
00256 #ifdef __USE_ISOC99
00257 __BEGIN_NAMESPACE_C99
00258 /* True gamma function.  */
00259 __MATHCALL (tgamma,, (_Mdouble_));
00260 __END_NAMESPACE_C99
00261 #endif
00262 
00263 #if defined __USE_MISC || defined __USE_XOPEN
00264 /* Obsolete alias for `lgamma'.  */
00265 __MATHCALL (gamma,, (_Mdouble_));
00266 #endif
00267 
00268 #ifdef __USE_MISC
00269 /* Reentrant version of lgamma.  This function uses the global variable
00270    `signgam'.  The reentrant version instead takes a pointer and stores
00271    the value through it.  */
00272 __MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp));
00273 #endif
00274 
00275 
00276 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
00277 __BEGIN_NAMESPACE_C99
00278 /* Return the integer nearest X in the direction of the
00279    prevailing rounding mode.  */
00280 __MATHCALL (rint,, (_Mdouble_ __x));
00281 
00282 /* Return X + epsilon if X < Y, X - epsilon if X > Y.  */
00283 __MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
00284 # if defined __USE_ISOC99 && !defined __LDBL_COMPAT
00285 __MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__));
00286 # endif
00287 
00288 /* Return the remainder of integer divison X / Y with infinite precision.  */
00289 __MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y));
00290 
00291 # if defined __USE_MISC || defined __USE_ISOC99
00292 /* Return X times (2 to the Nth power).  */
00293 __MATHCALL (scalbn,, (_Mdouble_ __x, int __n));
00294 # endif
00295 
00296 /* Return the binary exponent of X, which must be nonzero.  */
00297 __MATHDECL (int,ilogb,, (_Mdouble_ __x));
00298 #endif
00299 
00300 #ifdef __USE_ISOC99
00301 /* Return X times (2 to the Nth power).  */
00302 __MATHCALL (scalbln,, (_Mdouble_ __x, long int __n));
00303 
00304 /* Round X to integral value in floating-point format using current
00305    rounding direction, but do not raise inexact exception.  */
00306 __MATHCALL (nearbyint,, (_Mdouble_ __x));
00307 
00308 /* Round X to nearest integral value, rounding halfway cases away from
00309    zero.  */
00310 __MATHCALLX (round,, (_Mdouble_ __x), (__const__));
00311 
00312 /* Round X to the integral value in floating-point format nearest but
00313    not larger in magnitude.  */
00314 __MATHCALLX (trunc,, (_Mdouble_ __x), (__const__));
00315 
00316 /* Compute remainder of X and Y and put in *QUO a value with sign of x/y
00317    and magnitude congruent `mod 2^n' to the magnitude of the integral
00318    quotient x/y, with n >= 3.  */
00319 __MATHCALL (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo));
00320 
00321 
00322 /* Conversion functions.  */
00323 
00324 /* Round X to nearest integral value according to current rounding
00325    direction.  */
00326 __MATHDECL (long int,lrint,, (_Mdouble_ __x));
00327 __MATHDECL (long long int,llrint,, (_Mdouble_ __x));
00328 
00329 /* Round X to nearest integral value, rounding halfway cases away from
00330    zero.  */
00331 __MATHDECL (long int,lround,, (_Mdouble_ __x));
00332 __MATHDECL (long long int,llround,, (_Mdouble_ __x));
00333 
00334 
00335 /* Return positive difference between X and Y.  */
00336 __MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y));
00337 
00338 /* Return maximum numeric value from X and Y.  */
00339 __MATHCALL (fmax,, (_Mdouble_ __x, _Mdouble_ __y));
00340 
00341 /* Return minimum numeric value from X and Y.  */
00342 __MATHCALL (fmin,, (_Mdouble_ __x, _Mdouble_ __y));
00343 
00344 
00345 /* Classify given number.  */
00346 __MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value))
00347      __attribute__ ((__const__));
00348 
00349 /* Test for negative number.  */
00350 __MATHDECL_1 (int, __signbit,, (_Mdouble_ __value))
00351      __attribute__ ((__const__));
00352 
00353 
00354 /* Multiply-add function computed as a ternary operation.  */
00355 __MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
00356 #endif /* Use ISO C99.  */
00357 
00358 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
00359 __END_NAMESPACE_C99
00360 #endif
00361 
00362 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
00363 /* Return X times (2 to the Nth power).  */
00364 __MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
00365 #endif