mathcalls.h 13 KB

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