A RetroSearch Logo

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

Search Query:

Showing content from https://en.cppreference.com/w/cpp/algorithm/../../cpp/../c/header/../numeric/complex/imaginary.html below:

imaginary - cppreference.com

#define imaginary _Imaginary

(since C99)

This macro expands to the keyword _Imaginary.

This is a convenience macro that makes it possible to use float imaginary, double imaginary, and long double imaginary as an alternative way to write the three pure imaginary C types float _Imaginary, double _Imaginary, and long double _Imaginary

As with any pure imaginary number support in C, this macro is only defined if the imaginary numbers are supported.

A compiler that defines __STDC_IEC_559_COMPLEX__ is not required to support imaginary numbers. POSIX recommends checking if the macro _Imaginary_I is defined to identify imaginary number support.

(since C99)
(until C11)

Imaginary numbers are supported if __STDC_IEC_559_COMPLEX__ is defined.

(since C11) [edit] Notes

Programs are allowed to undefine and perhaps redefine the imaginary macro.

To date, only Oracle C compiler is known to have implemented imaginary types.

[edit] Example
#include <stdio.h>
#include <complex.h>
 
int main(void)
{
    double imaginary i = -2.0*I; // pure imaginary
    double f = 1.0; // pure real
    double complex z = f + i; // complex number
    printf("z = %.1f%+.1fi\n", creal(z), cimag(z));
}

Output:

[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