cmathcalls.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /* Prototype declarations for complex math functions;
  2. helper file for <complex.h>.
  3. Copyright (C) 1997, 1998 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 Library General Public License as
  7. published by the Free Software Foundation; either version 2 of the
  8. 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. Library General Public License for more details.
  13. You should have received a copy of the GNU Library General Public
  14. License along with the GNU C Library; see the file COPYING.LIB. If not,
  15. write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  16. Boston, MA 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. /* Arc sine of Z. */
  41. __MATHCALL (casin, (_Mdouble_complex_ __z));
  42. /* Arc tangent of Z. */
  43. __MATHCALL (catan, (_Mdouble_complex_ __z));
  44. /* Cosine of Z. */
  45. __MATHCALL (ccos, (_Mdouble_complex_ __z));
  46. /* Sine of Z. */
  47. __MATHCALL (csin, (_Mdouble_complex_ __z));
  48. /* Tangent of Z. */
  49. __MATHCALL (ctan, (_Mdouble_complex_ __z));
  50. /* Hyperbolic functions. */
  51. /* Hyperbolic arc cosine of Z. */
  52. __MATHCALL (cacosh, (_Mdouble_complex_ __z));
  53. /* Hyperbolic arc sine of Z. */
  54. __MATHCALL (casinh, (_Mdouble_complex_ __z));
  55. /* Hyperbolic arc tangent of Z. */
  56. __MATHCALL (catanh, (_Mdouble_complex_ __z));
  57. /* Hyperbolic cosine of Z. */
  58. __MATHCALL (ccosh, (_Mdouble_complex_ __z));
  59. /* Hyperbolic sine of Z. */
  60. __MATHCALL (csinh, (_Mdouble_complex_ __z));
  61. /* Hyperbolic tangent of Z. */
  62. __MATHCALL (ctanh, (_Mdouble_complex_ __z));
  63. /* Exponential and logarithmic functions. */
  64. /* Exponential function of Z. */
  65. __MATHCALL (cexp, (_Mdouble_complex_ __z));
  66. /* Natural logarithm of Z. */
  67. __MATHCALL (clog, (_Mdouble_complex_ __z));
  68. #ifdef __USE_GNU
  69. /* The base 10 logarithm is not defined by the standard but to implement
  70. the standard C++ library it is handy. */
  71. __MATHCALL (clog10, (_Mdouble_complex_ __z));
  72. #endif
  73. /* Power functions. */
  74. /* Return X to the Y power. */
  75. __MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y));
  76. /* Return the square root of Z. */
  77. __MATHCALL (csqrt, (_Mdouble_complex_ __z));
  78. /* Absolute value, conjugates, and projection. */
  79. /* Absolute value of Z. */
  80. __MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z));
  81. /* Argument value of Z. */
  82. __MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z));
  83. /* Complex conjugate of Z. */
  84. __MATHCALL (conj, (_Mdouble_complex_ __z));
  85. /* Projection of Z onto the Riemann sphere. */
  86. __MATHCALL (cproj, (_Mdouble_complex_ __z));
  87. /* Decomposing complex values. */
  88. /* Imaginary part of Z. */
  89. __MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z));
  90. /* Real part of Z. */
  91. __MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z));
  92. /* Now some optimized versions. GCC has handy notations for these
  93. functions. */
  94. #if defined __GNUC__ && defined __OPTIMIZE__
  95. /* Imaginary part of Z. */
  96. extern __inline _Mdouble_
  97. __MATH_PRECNAME(cimag) (_Mdouble_complex_ __z)
  98. {
  99. return __imag__ __z;
  100. }
  101. /* Real part of Z. */
  102. extern __inline _Mdouble_
  103. __MATH_PRECNAME(creal) (_Mdouble_complex_ __z)
  104. {
  105. return __real__ __z;
  106. }
  107. /* Complex conjugate of Z. */
  108. extern __inline _Mdouble_complex_
  109. __MATH_PRECNAME(conj) (_Mdouble_complex_ __z)
  110. {
  111. return ~__z;
  112. }
  113. #endif