From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/numeric%2Fcomplex%2Fimaginary.html | 47 ++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 devdocs/c/numeric%2Fcomplex%2Fimaginary.html (limited to 'devdocs/c/numeric%2Fcomplex%2Fimaginary.html') diff --git a/devdocs/c/numeric%2Fcomplex%2Fimaginary.html b/devdocs/c/numeric%2Fcomplex%2Fimaginary.html new file mode 100644 index 00000000..5b1db5b0 --- /dev/null +++ b/devdocs/c/numeric%2Fcomplex%2Fimaginary.html @@ -0,0 +1,47 @@ +

imaginary

Defined in header <complex.h>
#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)

Notes

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

+

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:

+
z = 1.0-2.0i

References

See also

+
+
(C99)
complex type macro
(keyword macro)
+

+ © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ https://en.cppreference.com/w/c/numeric/complex/imaginary +

+
-- cgit v1.2.3