# _Complex_I

< c‎ | numeric‎ | complex

C
 Language Headers Type support Program utilities Variadic function support Error handling Dynamic memory management Date and time utilities Strings library Algorithms Numerics Input/output support Localization support Atomic operations (C11) Thread support (C11) Technical Specifications

Complex number arithmetic
Types and the imaginary constant
 complex(C99) _Complex_I(C99) CMPLX(C11)
 imaginary(C99) _Imaginary_I(C99) I(C99)
Manipulation
 cimag(C99) creal(C99) carg(C99)
 cabs(C99) conj(C99) cproj(C99)
Power and exponential functions
 cexp(C99) clog(C99)
 cpow(C99) csqrt(C99)
Trigonometric functions
 ccos(C99) csin(C99) ctan(C99)
 cacos(C99) casin(C99) catan(C99)
Hyperbolic functions
 ccosh(C99) csinh(C99) ctanh(C99)
 cacosh(C99) casinh(C99) catanh(C99)

 Defined in header  #define _Complex_I /* unspecified */ (since C99)

The _Complex_I macro expands to a value of type const float _Complex with the value of the imaginary unit.

## Contents

### Notes

This macro may be used when I is not available, such as when it has been undefined by the application.

Unlike _Imaginary_I and CMPLX, use of this macro to construct a complex number may lose the sign of zero on the imaginary component.

### Example

#include <stdio.h>
#include <complex.h>

#undef I
#define J _Complex_I // can be used to redefine I

int main(void)
{
// can be used to construct a complex number
double complex z = 1.0 + 2.0 * _Complex_I;
printf("1.0 + 2.0 * _Complex_I = %.1f%+.1fi\n", creal(z), cimag(z));

// sign of zero may not be preserved
double complex z2 = 0.0 + -0.0 * _Complex_I;
printf("0.0 + -0.0 * _Complex_I = %.1f%+.1fi\n", creal(z2), cimag(z2));
}

Possible output:

1.0 + 2.0 * _Complex_I = 1.0+2.0i
0.0 + -0.0 * _Complex_I = 0.0+0.0i

### References

• C11 standard (ISO/IEC 9899:2011):
• 7.3.1/4 _Complex_I (p: 188)
• C99 standard (ISO/IEC 9899:1999):
• 7.3.1/2 _Complex_I (p: 170)