mathcalls.h 12 KB

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