mathcalls.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. /* Prototype declarations for math functions; helper file for <math.h>.
  2. Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library; if not, write to the Free
  14. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA. */
  16. /* NOTE: Because of the special way this file is used by <math.h>, this
  17. file must NOT be protected from multiple inclusion as header files
  18. usually are.
  19. This file provides prototype declarations for the math functions.
  20. Most functions are declared using the macro:
  21. __MATHCALL (NAME,[_r], (ARGS...));
  22. This means there is a function `NAME' returning `double' and a function
  23. `NAMEf' returning `float'. Each place `_Mdouble_' appears in the
  24. prototype, that is actually `double' in the prototype for `NAME' and
  25. `float' in the prototype for `NAMEf'. Reentrant variant functions are
  26. called `NAME_r' and `NAMEf_r'.
  27. Functions returning other types like `int' are declared using the macro:
  28. __MATHDECL (TYPE, NAME,[_r], (ARGS...));
  29. This is just like __MATHCALL but for a function returning `TYPE'
  30. instead of `_Mdouble_'. In all of these cases, there is still
  31. both a `NAME' and a `NAMEf' that takes `float' arguments.
  32. Note that there must be no whitespace before the argument passed for
  33. NAME, to make token pasting work with -traditional. */
  34. #ifndef _MATH_H
  35. #error "Never include <bits/mathcalls.h> directly; include <math.h> instead."
  36. #endif
  37. /* Trigonometric functions. */
  38. /* Arc cosine of X. */
  39. __MATHCALL (acos,, (_Mdouble_ __x));
  40. /* Arc sine of X. */
  41. __MATHCALL (asin,, (_Mdouble_ __x));
  42. /* Arc tangent of X. */
  43. __MATHCALL (atan,, (_Mdouble_ __x));
  44. /* Arc tangent of Y/X. */
  45. __MATHCALL (atan2,, (_Mdouble_ __y, _Mdouble_ __x));
  46. /* Cosine of X. */
  47. __MATHCALL (cos,, (_Mdouble_ __x));
  48. /* Sine of X. */
  49. __MATHCALL (sin,, (_Mdouble_ __x));
  50. /* Tangent of X. */
  51. __MATHCALL (tan,, (_Mdouble_ __x));
  52. #ifdef __USE_GNU
  53. /* Cosine and sine of X. */
  54. __MATHDECL (void,sincos,,
  55. (_Mdouble_ __x, _Mdouble_ *__sinx, _Mdouble_ *__cosx));
  56. #endif
  57. /* Hyperbolic functions. */
  58. /* Hyperbolic cosine of X. */
  59. __MATHCALL (cosh,, (_Mdouble_ __x));
  60. /* Hyperbolic sine of X. */
  61. __MATHCALL (sinh,, (_Mdouble_ __x));
  62. /* Hyperbolic tangent of X. */
  63. __MATHCALL (tanh,, (_Mdouble_ __x));
  64. #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
  65. /* Hyperbolic arc cosine of X. */
  66. __MATHCALL (acosh,, (_Mdouble_ __x));
  67. /* Hyperbolic arc sine of X. */
  68. __MATHCALL (asinh,, (_Mdouble_ __x));
  69. /* Hyperbolic arc tangent of X. */
  70. __MATHCALL (atanh,, (_Mdouble_ __x));
  71. #endif
  72. /* Exponential and logarithmic functions. */
  73. /* Exponential function of X. */
  74. __MATHCALL (exp,, (_Mdouble_ __x));
  75. #ifdef __USE_GNU
  76. /* A function missing in all standards: compute exponent to base ten. */
  77. __MATHCALL (exp10,, (_Mdouble_ __x));
  78. /* Another name occasionally used. */
  79. __MATHCALL (pow10,, (_Mdouble_ __x));
  80. #endif
  81. /* Break VALUE into a normalized fraction and an integral power of 2. */
  82. __MATHCALL (frexp,, (_Mdouble_ __x, int *__exponent));
  83. /* X times (two to the EXP power). */
  84. __MATHCALL (ldexp,, (_Mdouble_ __x, int __exponent));
  85. /* Natural logarithm of X. */
  86. __MATHCALL (log,, (_Mdouble_ __x));
  87. /* Base-ten logarithm of X. */
  88. __MATHCALL (log10,, (_Mdouble_ __x));
  89. /* Break VALUE into integral and fractional parts. */
  90. __MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr));
  91. #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
  92. /* Return exp(X) - 1. */
  93. __MATHCALL (expm1,, (_Mdouble_ __x));
  94. /* Return log(1 + X). */
  95. __MATHCALL (log1p,, (_Mdouble_ __x));
  96. /* Return the base 2 signed integral exponent of X. */
  97. __MATHCALL (logb,, (_Mdouble_ __x));
  98. #endif
  99. #ifdef __USE_ISOC99
  100. /* Compute base-2 exponential of X. */
  101. __MATHCALL (exp2,, (_Mdouble_ __x));
  102. /* Compute base-2 logarithm of X. */
  103. __MATHCALL (log2,, (_Mdouble_ __x));
  104. #endif
  105. /* Power functions. */
  106. /* Return X to the Y power. */
  107. __MATHCALL (pow,, (_Mdouble_ __x, _Mdouble_ __y));
  108. /* Return the square root of X. */
  109. __MATHCALL (sqrt,, (_Mdouble_ __x));
  110. #if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
  111. /* Return `sqrt(X*X + Y*Y)'. */
  112. __MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
  113. #endif
  114. #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
  115. /* Return the cube root of X. */
  116. __MATHCALL (cbrt,, (_Mdouble_ __x));
  117. #endif
  118. /* Nearest integer, absolute value, and remainder functions. */
  119. /* Smallest integral value not less than X. */
  120. __MATHCALL (ceil,, (_Mdouble_ __x));
  121. /* Absolute value of X. */
  122. __MATHCALLX (fabs,, (_Mdouble_ __x), (__const__));
  123. /* Largest integer not greater than X. */
  124. __MATHCALL (floor,, (_Mdouble_ __x));
  125. /* Floating-point modulo remainder of X/Y. */
  126. __MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
  127. /* Return 0 if VALUE is finite or NaN, +1 if it
  128. is +Infinity, -1 if it is -Infinity. */
  129. __MATHDECL_1 (int,__isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
  130. /* Return nonzero if VALUE is finite and not NaN. */
  131. __MATHDECL_1 (int,__finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
  132. #ifdef __USE_MISC
  133. /* Return 0 if VALUE is finite or NaN, +1 if it
  134. is +Infinity, -1 if it is -Infinity. */
  135. __MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
  136. /* Return nonzero if VALUE is finite and not NaN. */
  137. __MATHDECL_1 (int,finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
  138. /* Return the remainder of X/Y. */
  139. __MATHCALL (drem,, (_Mdouble_ __x, _Mdouble_ __y));
  140. /* Return the fractional part of X after dividing out `ilogb (X)'. */
  141. __MATHCALL (significand,, (_Mdouble_ __x));
  142. #endif /* Use misc. */
  143. #if defined __USE_MISC || defined __USE_ISOC99
  144. /* Return X with its signed changed to Y's. */
  145. __MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
  146. #endif
  147. #ifdef __USE_ISOC99
  148. /* Return representation of NaN for double type. */
  149. __MATHCALLX (nan,, (__const char *__tagb), (__const__));
  150. #endif
  151. /* Return nonzero if VALUE is not a number. */
  152. __MATHDECL_1 (int,__isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
  153. #if defined __USE_MISC || defined __USE_XOPEN
  154. /* Return nonzero if VALUE is not a number. */
  155. __MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
  156. /* Bessel functions. */
  157. __MATHCALL (j0,, (_Mdouble_));
  158. __MATHCALL (j1,, (_Mdouble_));
  159. __MATHCALL (jn,, (int, _Mdouble_));
  160. __MATHCALL (y0,, (_Mdouble_));
  161. __MATHCALL (y1,, (_Mdouble_));
  162. __MATHCALL (yn,, (int, _Mdouble_));
  163. #endif
  164. #if defined __USE_MISC || defined __USE_XOPEN || defined __USE_ISOC99
  165. /* Error and gamma functions. */
  166. __MATHCALL (erf,, (_Mdouble_));
  167. __MATHCALL (erfc,, (_Mdouble_));
  168. __MATHCALL (lgamma,, (_Mdouble_));
  169. #endif
  170. #ifdef __USE_ISOC99
  171. __MATHCALL (tgamma,, (_Mdouble_));
  172. #endif
  173. #if defined __USE_MISC || defined __USE_XOPEN
  174. /* Obsolete alias for `lgamma'. */
  175. __MATHCALL (gamma,, (_Mdouble_));
  176. #endif
  177. #ifdef __USE_MISC
  178. /* Reentrant version of lgamma. This function uses the global variable
  179. `signgam'. The reentrant version instead takes a pointer and stores
  180. the value through it. */
  181. __MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp));
  182. #endif
  183. #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
  184. /* Return the integer nearest X in the direction of the
  185. prevailing rounding mode. */
  186. __MATHCALL (rint,, (_Mdouble_ __x));
  187. /* Return X + epsilon if X < Y, X - epsilon if X > Y. */
  188. __MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
  189. # ifdef __USE_ISOC99
  190. __MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__));
  191. # endif
  192. /* Return the remainder of integer divison X / Y with infinite precision. */
  193. __MATHCALL (remainder,, (_Mdouble_ __x, _Mdouble_ __y));
  194. # if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
  195. /* Return X times (2 to the Nth power). */
  196. __MATHCALL (scalb,, (_Mdouble_ __x, _Mdouble_ __n));
  197. # endif
  198. # if defined __USE_MISC || defined __USE_ISOC99
  199. /* Return X times (2 to the Nth power). */
  200. __MATHCALL (scalbn,, (_Mdouble_ __x, int __n));
  201. # endif
  202. /* Return the binary exponent of X, which must be nonzero. */
  203. __MATHDECL (int,ilogb,, (_Mdouble_ __x));
  204. #endif
  205. #ifdef __USE_ISOC99
  206. /* Return X times (2 to the Nth power). */
  207. __MATHCALL (scalbln,, (_Mdouble_ __x, long int __n));
  208. /* Round X to integral value in floating-point format using current
  209. rounding direction, but do not raise inexact exception. */
  210. __MATHCALL (nearbyint,, (_Mdouble_ __x));
  211. /* Round X to nearest integral value, rounding halfway cases away from
  212. zero. */
  213. __MATHCALL (round,, (_Mdouble_ __x));
  214. /* Round X to the integral value in floating-point format nearest but
  215. not larger in magnitude. */
  216. __MATHCALLX (trunc,, (_Mdouble_ __x), (__const__));
  217. /* Compute remainder of X and Y and put in *QUO a value with sign of x/y
  218. and magnitude congruent `mod 2^n' to the magnitude of the integral
  219. quotient x/y, with n >= 3. */
  220. __MATHCALL (remquo,, (_Mdouble_ __x, _Mdouble_ __y, int *__quo));
  221. /* Conversion functions. */
  222. /* Round X to nearest integral value according to current rounding
  223. direction. */
  224. __MATHDECL (long int,lrint,, (_Mdouble_ __x));
  225. __MATHDECL (long long int,llrint,, (_Mdouble_ __x));
  226. /* Round X to nearest integral value, rounding halfway cases away from
  227. zero. */
  228. __MATHDECL (long int,lround,, (_Mdouble_ __x));
  229. __MATHDECL (long long int,llround,, (_Mdouble_ __x));
  230. /* Return positive difference between X and Y. */
  231. __MATHCALL (fdim,, (_Mdouble_ __x, _Mdouble_ __y));
  232. /* Return maximum numeric value from X and Y. */
  233. __MATHCALL (fmax,, (_Mdouble_ __x, _Mdouble_ __y));
  234. /* Return minimum numeric value from X and Y. */
  235. __MATHCALL (fmin,, (_Mdouble_ __x, _Mdouble_ __y));
  236. /* Classify given number. */
  237. __MATHDECL_1 (int, __fpclassify,, (_Mdouble_ __value))
  238. __attribute__ ((__const__));
  239. /* Test for negative number. */
  240. __MATHDECL_1 (int, __signbit,, (_Mdouble_ __value))
  241. __attribute__ ((__const__));
  242. /* Multiply-add function computed as a ternary operation. */
  243. __MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
  244. #endif /* Use ISO C99. */