June 2025 | ||||||
Mo | Tu | We | Th | Fr | Sa | Su |
26 | 27 | 28 | 29 | 30 | 31 | 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 1 | 2 | 3 | 4 | 5 | 6 |
001: /* Prototype declarations for complex math functions; 002: helper file for <complex.h>. 003: Copyright (C) 1997, 1998, 2001, 2007 Free Software Foundation, Inc. 004: This file is part of the GNU C Library. 005: 006: The GNU C Library is free software; you can redistribute it and/or 007: modify it under the terms of the GNU Lesser General Public 008: License as published by the Free Software Foundation; either 009: version 2.1 of the License, or (at your option) any later version. 010: 011: The GNU C Library is distributed in the hope that it will be useful, 012: but WITHOUT ANY WARRANTY; without even the implied warranty of 013: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014: Lesser General Public License for more details. 015: 016: You should have received a copy of the GNU Lesser General Public 017: License along with the GNU C Library; if not, write to the Free 018: Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 019: 02111-1307 USA. */ 020: 021: /* NOTE: Because of the special way this file is used by <complex.h>, this 022: file must NOT be protected from multiple inclusion as header files 023: usually are. 024: 025: This file provides prototype declarations for the math functions. 026: Most functions are declared using the macro: 027: 028: __MATHCALL (NAME, (ARGS...)); 029: 030: This means there is a function `NAME' returning `double' and a function 031: `NAMEf' returning `float'. Each place `_Mdouble_' appears in the 032: prototype, that is actually `double' in the prototype for `NAME' and 033: `float' in the prototype for `NAMEf'. Reentrant variant functions are 034: called `NAME_r' and `NAMEf_r'. 035: 036: Functions returning other types like `int' are declared using the macro: 037: 038: __MATHDECL (TYPE, NAME, (ARGS...)); 039: 040: This is just like __MATHCALL but for a function returning `TYPE' 041: instead of `_Mdouble_'. In all of these cases, there is still 042: both a `NAME' and a `NAMEf' that takes `float' arguments. */ 043: 044: #ifndef _COMPLEX_H 045: #error "Never use <bits/cmathcalls.h> directly; include <complex.h> instead." 046: #endif 047: 048: #define _Mdouble_complex_ _Mdouble_ _Complex 049: 050: 051: /* Trigonometric functions. */ 052: 053: /* Arc cosine of Z. */ 054: __MATHCALL (cacos, (_Mdouble_complex_ __z)); 055: /* Arc sine of Z. */ 056: __MATHCALL (casin, (_Mdouble_complex_ __z)); 057: /* Arc tangent of Z. */ 058: __MATHCALL (catan, (_Mdouble_complex_ __z)); 059: 060: /* Cosine of Z. */ 061: __MATHCALL (ccos, (_Mdouble_complex_ __z)); 062: /* Sine of Z. */ 063: __MATHCALL (csin, (_Mdouble_complex_ __z)); 064: /* Tangent of Z. */ 065: __MATHCALL (ctan, (_Mdouble_complex_ __z)); 066: 067: 068: /* Hyperbolic functions. */ 069: 070: /* Hyperbolic arc cosine of Z. */ 071: __MATHCALL (cacosh, (_Mdouble_complex_ __z)); 072: /* Hyperbolic arc sine of Z. */ 073: __MATHCALL (casinh, (_Mdouble_complex_ __z)); 074: /* Hyperbolic arc tangent of Z. */ 075: __MATHCALL (catanh, (_Mdouble_complex_ __z)); 076: 077: /* Hyperbolic cosine of Z. */ 078: __MATHCALL (ccosh, (_Mdouble_complex_ __z)); 079: /* Hyperbolic sine of Z. */ 080: __MATHCALL (csinh, (_Mdouble_complex_ __z)); 081: /* Hyperbolic tangent of Z. */ 082: __MATHCALL (ctanh, (_Mdouble_complex_ __z)); 083: 084: 085: /* Exponential and logarithmic functions. */ 086: 087: /* Exponential function of Z. */ 088: __MATHCALL (cexp, (_Mdouble_complex_ __z)); 089: 090: /* Natural logarithm of Z. */ 091: __MATHCALL (clog, (_Mdouble_complex_ __z)); 092: 093: #ifdef __USE_GNU 094: /* The base 10 logarithm is not defined by the standard but to implement 095: the standard C++ library it is handy. */ 096: __MATHCALL (clog10, (_Mdouble_complex_ __z)); 097: #endif 098: 099: /* Power functions. */ 100: 101: /* Return X to the Y power. */ 102: __MATHCALL (cpow, (_Mdouble_complex_ __x, _Mdouble_complex_ __y)); 103: 104: /* Return the square root of Z. */ 105: __MATHCALL (csqrt, (_Mdouble_complex_ __z)); 106: 107: 108: /* Absolute value, conjugates, and projection. */ 109: 110: /* Absolute value of Z. */ 111: __MATHDECL (_Mdouble_,cabs, (_Mdouble_complex_ __z)); 112: 113: /* Argument value of Z. */ 114: __MATHDECL (_Mdouble_,carg, (_Mdouble_complex_ __z)); 115: 116: /* Complex conjugate of Z. */ 117: __MATHCALL (conj, (_Mdouble_complex_ __z)); 118: 119: /* Projection of Z onto the Riemann sphere. */ 120: __MATHCALL (cproj, (_Mdouble_complex_ __z)); 121: 122: 123: /* Decomposing complex values. */ 124: 125: /* Imaginary part of Z. */ 126: __MATHDECL (_Mdouble_,cimag, (_Mdouble_complex_ __z)); 127: 128: /* Real part of Z. */ 129: __MATHDECL (_Mdouble_,creal, (_Mdouble_complex_ __z)); 130: 131: 132: /* Now some optimized versions. GCC has handy notations for these 133: functions. Recent GCC handles these as builtin functions so does 134: not need inlines. */ 135: #if defined __GNUC__ && !__GNUC_PREREQ (2, 97) && defined __OPTIMIZE__ \ 136: && defined __extern_inline 137: 138: /* Imaginary part of Z. */ 139: __extern_inline _Mdouble_ 140: __MATH_PRECNAME(cimag) (_Mdouble_complex_ __z) __THROW 141: { 142: return __imag__ __z; 143: } 144: 145: /* Real part of Z. */ 146: __extern_inline _Mdouble_ 147: __MATH_PRECNAME(creal) (_Mdouble_complex_ __z) __THROW 148: { 149: return __real__ __z; 150: } 151: 152: /* Complex conjugate of Z. */ 153: __extern_inline _Mdouble_complex_ 154: __MATH_PRECNAME(conj) (_Mdouble_complex_ __z) __THROW 155: { 156: return __extension__ ~__z; 157: } 158: 159: #endif 160: