cmathcalls.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /* Prototype declarations for complex math functions;
  2. helper file for <complex.h>.
  3. Copyright (C) 1997, 1998, 2001 Free Software Foundation, Inc.
  4. This file is part of the GNU C Library.
  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. The GNU C Library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with the GNU C Library; if not, see
  15. <http://www.gnu.org/licenses/>. */
  16. /* NOTE: Because of the special way this file is used by <complex.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, (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, (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. #ifndef _COMPLEX_H
  33. #error "Never use <bits/cmathcalls.h> directly; include <complex.h> instead."
  34. #endif
  35. #define _Mdouble_complex_ _Mdouble_ _Complex
  36. /* Trigonometric functions. */
  37. /* Arc cosine of Z. */
  38. __MATHCALL (cacos, (_Mdouble_complex_ __z));
  39. libm_hidden_proto(cacos)
  40. /* Arc sine of Z. */
  41. __MATHCALL (casin, (_Mdouble_complex_ __z));
  42. libm_hidden_proto(casin)
  43. /* Arc tangent of Z. */
  44. __MATHCALL (catan, (_Mdouble_complex_ __z));
  45. libm_hidden_proto(catan)
  46. /* Cosine of Z. */
  47. __MATHCALL (ccos, (_Mdouble_complex_ __z));
  48. libm_hidden_proto(ccos)
  49. /* Sine of Z. */
  50. __MATHCALL (csin, (_Mdouble_complex_ __z));
  51. libm_hidden_proto(csin)
  52. /* Tangent of Z. */
  53. __MATHCALL (ctan, (_Mdouble_complex_ __z));
  54. libm_hidden_proto(ctan)
  55. /* Hyperbolic functions. */
  56. /* Hyperbolic arc cosine of Z. */
  57. __MATHCALL (cacosh, (_Mdouble_complex_ __z));
  58. libm_hidden_proto(cacosh)
  59. /* Hyperbolic arc sine of Z. */
  60. __MATHCALL (casinh, (_Mdouble_complex_ __z));
  61. libm_hidden_proto(casinh)
  62. /* Hyperbolic arc tangent of Z. */
  63. __MATHCALL (catanh, (_Mdouble_complex_ __z));
  64. libm_hidden_proto(catanh)
  65. /* Hyperbolic cosine of Z. */
  66. __MATHCALL (ccosh, (_Mdouble_complex_ __z));
  67. libm_hidden_proto(ccosh)
  68. /* Hyperbolic sine of Z. */
  69. __MATHCALL (csinh, (_Mdouble_complex_ __z));
  70. libm_hidden_proto(ccosh)
  71. /* Hyperbolic tangent of Z. */
  72. __MATHCALL (ctanh, (_Mdouble_complex_ __z));
  73. libm_hidden_proto(ctanh)
  74. /* Exponential and logarithmic functions. */
  75. /* Exponential function of Z. */
  76. __MATHCALL (cexp, (_Mdouble_complex_ __z));
  77. libm_hidden_proto(cexp)
  78. /* Natural logarithm of Z. */
  79. __MATHCALL (clog, (_Mdouble_complex_ __z));
  80. libm_hidden_proto(clog)
  81. #ifdef __USE_GNU
  82. /* The base 10 logarithm is not defined by the standard but to implement
  83. the standard C++ library it is handy. */
  84. __MATHCALL (clog10, (_Mdouble_complex_ __z));
  85. libm_hidden_proto(clog10)
  86. #endif
  87. /* Power functions. */
  88. /* Return X to the Y power. */
  89. __MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y));
  90. libm_hidden_proto(cpow)
  91. /* Return the square root of Z. */
  92. __MATHCALL (csqrt, (_Mdouble_complex_ __z));
  93. libm_hidden_proto(csqrt)
  94. /* Absolute value, conjugates, and projection. */
  95. /* Absolute value of Z. */
  96. __MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z));
  97. libm_hidden_proto(cabs)
  98. /* Argument value of Z. */
  99. __MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z));
  100. libm_hidden_proto(carg)
  101. /* Complex conjugate of Z. */
  102. __MATHCALL (conj, (_Mdouble_complex_ __z));
  103. libm_hidden_proto(conj)
  104. /* Projection of Z onto the Riemann sphere. */
  105. __MATHCALL (cproj, (_Mdouble_complex_ __z));
  106. libm_hidden_proto(cproj)
  107. /* Decomposing complex values. */
  108. /* Imaginary part of Z. */
  109. __MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z));
  110. libm_hidden_proto(cimag)
  111. /* Real part of Z. */
  112. __MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z));
  113. libm_hidden_proto(creal)
  114. /* Now some optimized versions. GCC has handy notations for these
  115. functions. Recent GCC handles these as builtin functions so does
  116. not need inlines. */
  117. #if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__
  118. /* Imaginary part of Z. */
  119. __extern_inline _Mdouble_
  120. __MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW
  121. {
  122. return __imag__ __z;
  123. }
  124. /* Real part of Z. */
  125. __extern_inline _Mdouble_
  126. __MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW
  127. {
  128. return __real__ __z;
  129. }
  130. /* Complex conjugate of Z. */
  131. __extern_inline _Mdouble_complex_
  132. __MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW
  133. {
  134. return __extension__ ~__z;
  135. }
  136. #endif