cmathcalls.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. __BEGIN_DECLS
  38. /* Trigonometric functions. */
  39. /* Arc cosine of Z. */
  40. __MATHCALL (cacos, (_Mdouble_complex_ __z));
  41. /* Arc sine of Z. */
  42. __MATHCALL (casin, (_Mdouble_complex_ __z));
  43. /* Arc tangent of Z. */
  44. __MATHCALL (catan, (_Mdouble_complex_ __z));
  45. /* Cosine of Z. */
  46. __MATHCALL (ccos, (_Mdouble_complex_ __z));
  47. /* Sine of Z. */
  48. __MATHCALL (csin, (_Mdouble_complex_ __z));
  49. /* Tangent of Z. */
  50. __MATHCALL (ctan, (_Mdouble_complex_ __z));
  51. /* Hyperbolic functions. */
  52. /* Hyperbolic arc cosine of Z. */
  53. __MATHCALL (cacosh, (_Mdouble_complex_ __z));
  54. /* Hyperbolic arc sine of Z. */
  55. __MATHCALL (casinh, (_Mdouble_complex_ __z));
  56. /* Hyperbolic arc tangent of Z. */
  57. __MATHCALL (catanh, (_Mdouble_complex_ __z));
  58. /* Hyperbolic cosine of Z. */
  59. __MATHCALL (ccosh, (_Mdouble_complex_ __z));
  60. /* Hyperbolic sine of Z. */
  61. __MATHCALL (csinh, (_Mdouble_complex_ __z));
  62. /* Hyperbolic tangent of Z. */
  63. __MATHCALL (ctanh, (_Mdouble_complex_ __z));
  64. /* Exponential and logarithmic functions. */
  65. /* Exponential function of Z. */
  66. __MATHCALL (cexp, (_Mdouble_complex_ __z));
  67. /* Natural logarithm of Z. */
  68. __MATHCALL (clog, (_Mdouble_complex_ __z));
  69. #ifdef __USE_GNU
  70. /* The base 10 logarithm is not defined by the standard but to implement
  71. the standard C++ library it is handy. */
  72. __MATHCALL (clog10, (_Mdouble_complex_ __z));
  73. #endif
  74. /* Power functions. */
  75. /* Return X to the Y power. */
  76. __MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y));
  77. /* Return the square root of Z. */
  78. __MATHCALL (csqrt, (_Mdouble_complex_ __z));
  79. /* Absolute value, conjugates, and projection. */
  80. /* Absolute value of Z. */
  81. __MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z));
  82. /* Argument value of Z. */
  83. __MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z));
  84. /* Complex conjugate of Z. */
  85. __MATHCALL (conj, (_Mdouble_complex_ __z));
  86. /* Projection of Z onto the Riemann sphere. */
  87. __MATHCALL (cproj, (_Mdouble_complex_ __z));
  88. /* Decomposing complex values. */
  89. /* Imaginary part of Z. */
  90. __MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z));
  91. /* Real part of Z. */
  92. __MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z));
  93. /* Now some optimized versions. GCC has handy notations for these
  94. functions. */
  95. #if defined __GNUC__ && defined __OPTIMIZE__
  96. /* Imaginary part of Z. */
  97. extern __inline _Mdouble_
  98. __MATH_PRECNAME(cimag) (_Mdouble_complex_ __z)
  99. {
  100. return __imag__ __z;
  101. }
  102. /* Real part of Z. */
  103. extern __inline _Mdouble_
  104. __MATH_PRECNAME(creal) (_Mdouble_complex_ __z)
  105. {
  106. return __real__ __z;
  107. }
  108. /* Complex conjugate of Z. */
  109. extern __inline _Mdouble_complex_
  110. __MATH_PRECNAME(conj) (_Mdouble_complex_ __z)
  111. {
  112. return ~__z;
  113. }
  114. #endif
  115. __END_DECLS