cmathcalls.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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, write to the Free
  15. Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  16. 02111-1307 USA. */
  17. /* NOTE: Because of the special way this file is used by <complex.h>, this
  18. file must NOT be protected from multiple inclusion as header files
  19. usually are.
  20. This file provides prototype declarations for the math functions.
  21. Most functions are declared using the macro:
  22. __MATHCALL (NAME, (ARGS...));
  23. This means there is a function `NAME' returning `double' and a function
  24. `NAMEf' returning `float'. Each place `_Mdouble_' appears in the
  25. prototype, that is actually `double' in the prototype for `NAME' and
  26. `float' in the prototype for `NAMEf'. Reentrant variant functions are
  27. called `NAME_r' and `NAMEf_r'.
  28. Functions returning other types like `int' are declared using the macro:
  29. __MATHDECL (TYPE, NAME, (ARGS...));
  30. This is just like __MATHCALL but for a function returning `TYPE'
  31. instead of `_Mdouble_'. In all of these cases, there is still
  32. both a `NAME' and a `NAMEf' that takes `float' arguments. */
  33. #ifndef _COMPLEX_H
  34. #error "Never use <bits/cmathcalls.h> directly; include <complex.h> instead."
  35. #endif
  36. #define _Mdouble_complex_ _Mdouble_ _Complex
  37. /* Trigonometric functions. */
  38. /* Arc cosine of Z. */
  39. __MATHCALL (cacos, (_Mdouble_complex_ __z));
  40. libm_hidden_proto(cacos)
  41. /* Arc sine of Z. */
  42. __MATHCALL (casin, (_Mdouble_complex_ __z));
  43. libm_hidden_proto(casin)
  44. /* Arc tangent of Z. */
  45. __MATHCALL (catan, (_Mdouble_complex_ __z));
  46. libm_hidden_proto(catan)
  47. /* Cosine of Z. */
  48. __MATHCALL (ccos, (_Mdouble_complex_ __z));
  49. libm_hidden_proto(ccos)
  50. /* Sine of Z. */
  51. __MATHCALL (csin, (_Mdouble_complex_ __z));
  52. libm_hidden_proto(csin)
  53. /* Tangent of Z. */
  54. __MATHCALL (ctan, (_Mdouble_complex_ __z));
  55. libm_hidden_proto(ctan)
  56. /* Hyperbolic functions. */
  57. /* Hyperbolic arc cosine of Z. */
  58. __MATHCALL (cacosh, (_Mdouble_complex_ __z));
  59. libm_hidden_proto(cacosh)
  60. /* Hyperbolic arc sine of Z. */
  61. __MATHCALL (casinh, (_Mdouble_complex_ __z));
  62. libm_hidden_proto(casinh)
  63. /* Hyperbolic arc tangent of Z. */
  64. __MATHCALL (catanh, (_Mdouble_complex_ __z));
  65. libm_hidden_proto(catanh)
  66. /* Hyperbolic cosine of Z. */
  67. __MATHCALL (ccosh, (_Mdouble_complex_ __z));
  68. libm_hidden_proto(ccosh)
  69. /* Hyperbolic sine of Z. */
  70. __MATHCALL (csinh, (_Mdouble_complex_ __z));
  71. libm_hidden_proto(ccosh)
  72. /* Hyperbolic tangent of Z. */
  73. __MATHCALL (ctanh, (_Mdouble_complex_ __z));
  74. libm_hidden_proto(ctanh)
  75. /* Exponential and logarithmic functions. */
  76. /* Exponential function of Z. */
  77. __MATHCALL (cexp, (_Mdouble_complex_ __z));
  78. libm_hidden_proto(cexp)
  79. /* Natural logarithm of Z. */
  80. __MATHCALL (clog, (_Mdouble_complex_ __z));
  81. libm_hidden_proto(clog)
  82. #ifdef __USE_GNU
  83. /* The base 10 logarithm is not defined by the standard but to implement
  84. the standard C++ library it is handy. */
  85. __MATHCALL (clog10, (_Mdouble_complex_ __z));
  86. libm_hidden_proto(clog10)
  87. #endif
  88. /* Power functions. */
  89. /* Return X to the Y power. */
  90. __MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y));
  91. libm_hidden_proto(cpow)
  92. /* Return the square root of Z. */
  93. __MATHCALL (csqrt, (_Mdouble_complex_ __z));
  94. libm_hidden_proto(csqrt)
  95. /* Absolute value, conjugates, and projection. */
  96. /* Absolute value of Z. */
  97. __MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z));
  98. libm_hidden_proto(cabs)
  99. /* Argument value of Z. */
  100. __MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z));
  101. libm_hidden_proto(carg)
  102. /* Complex conjugate of Z. */
  103. __MATHCALL (conj, (_Mdouble_complex_ __z));
  104. libm_hidden_proto(conj)
  105. /* Projection of Z onto the Riemann sphere. */
  106. __MATHCALL (cproj, (_Mdouble_complex_ __z));
  107. libm_hidden_proto(cproj)
  108. /* Decomposing complex values. */
  109. /* Imaginary part of Z. */
  110. __MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z));
  111. libm_hidden_proto(cimag)
  112. /* Real part of Z. */
  113. __MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z));
  114. libm_hidden_proto(creal)
  115. /* Now some optimized versions. GCC has handy notations for these
  116. functions. Recent GCC handles these as builtin functions so does
  117. not need inlines. */
  118. #if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__
  119. /* Imaginary part of Z. */
  120. __extern_inline _Mdouble_
  121. __MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW
  122. {
  123. return __imag__ __z;
  124. }
  125. /* Real part of Z. */
  126. __extern_inline _Mdouble_
  127. __MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW
  128. {
  129. return __real__ __z;
  130. }
  131. /* Complex conjugate of Z. */
  132. __extern_inline _Mdouble_complex_
  133. __MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW
  134. {
  135. return __extension__ ~__z;
  136. }
  137. #endif