Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

C programming/complex.h

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Summary complex.h is a header file that defines functionality for complex arithmetic.bd complex.h SUS complex arithmetic These functions use the built-in type complex which was introduced with the C99 revision of C. This header should not be confused with the C++ standard library header <complex>, which implements complex numbers in a completely different way (as a template class, complex<T>). Macros Universal macro: complex - alias of _Complex _Complex_I - constant, which has type "const float _Complex" and value of imaginary unit I, I*I=-1 Defined only for `C99 Annex G`-compatible compiler modes - native support of imaginary types (it is very rare because Annex G is mathematically incorrectDr. Dobb's journal: software tools for the professional programmer, Volume 27 "many results in Annex G are pure invention and mathematically incorrect"): imaginary - alias of _Imaginary _Imaginary_I Expands to a constant expression of type const float _Imaginary with the value of the imaginary unit. Universal alias of I: I - alias of _Imaginary_I if it is defined else - alias of _Complex_I Application may undefine complex, imaginary, and I macros if they interfere with internal values. Functions Overview Each function declared in complex.h has three versions, each of which works with a different floating-point type (double, float and longdouble). Only the double version of each function is listed here; to use the float (or longdouble) version, append an f (or an l, respectively) to the function's name (e.g., cabsf and cabsl). Note that all angles are in radians. Basic operations cabs computes absolute valuecarg computes argument of a complex numbercimag computes imaginary part of a complex numbercreal computes real part of a complex numberconj computes complex conjugatecproj computes complex projection into the Riemann sphere Exponentiation operations cexp computes complex exponentialclog computes complex logarithmcsqrt computes complex square rootcpow computes complex power Trigonometric operations csin computes complex sineccos computes complex cosinectan computes complex tangentcasin computes complex arc sinecacos computes complex arc cosinecatan computes complex arc tangent Hyperbolic operations csinh computes complex hyperbolic sineccosh computes complex hyperbolic cosinectanh computes complex hyperbolic tangentcasinh computes complex hyperbolic arc sinecacosh computes complex hyperbolic arc cosinecatanh computes complex hyperbolic arc tangent References