A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://en.cppreference.com/w/c/numeric/math/../complex/complex.html below:

complex - cppreference.com

#define complex _Complex

(since C99)

This macro expands to a type specifier used to identify complex types.

A program may undefine and perhaps then redefine the complex macro.

[edit] Example
#include <complex.h>
#include <math.h>
#include <stdio.h>
 
void print_complex(const char* note, complex z)
{
    printf("%s %f%+f*i\n", note, creal(z), cimag(z));
}
 
int main(void)
{
    double complex z = -1.0 + 2.0*I;
    print_complex("z  =", z);
    print_complex("z\u00B2 =", z * z);
    double complex z2 = ccos(2.0 * carg(z)) + csin(2.0 * carg(z))*I;
    print_complex("z\u00B2 =", cabs(z) * cabs(z) * z2);
}

Output:

z  = -1.000000+2.000000*i
z² = -3.000000-4.000000*i
z² = -3.000000-4.000000*i
[edit] References
[edit] See also

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4