26
Numerics library
[numerics]
26.4
Complex numbers
[complex.numbers]
26.4.1
General
[complex.numbers.general]
1
#
The header
<complex>
defines a class template, and numerous functions for representing and manipulating complex numbers
.
2
#
The effect of instantiating the template
complex
for any type other than
float
,
double
, or
long
double
is unspecified
.
The specializations
complex
<
float
>
,
complex
<
double
>
, and
complex
<
long
double
>
are
literal types
.
3
#
If the result of a function is not mathematically defined or not in the range of representable values for its type, the behavior is undefined
.
4
#
If
z
is an lvalue of type
cv
complex
<
T
>
then:
(4.1)
the expression
reinterpret_cast
<
cv
T
(
&
)
[
2
]
>
(
z
)
is well-formed,
(4.2)
reinterpret_cast
<
cv
T
(
&
)
[
2
]
>
(
z
)
[
0
]
designates the real part of
z
, and
(4.3)
reinterpret_cast
<
cv
T
(
&
)
[
2
]
>
(
z
)
[
1
]
designates the imaginary part of
z
.
Moreover, if
a
is an expression of type
cv
complex
<
T
>
*
and the expression
a
[
i
]
is well-defined for an integer expression
i
, then:
(4.4)
reinterpret_cast
<
cv
T
*
>
(
a
)
[
2
*
i
]
designates the real part of
a
[
i
]
, and
(4.5)
reinterpret_cast
<
cv
T
*
>
(
a
)
[
2
*
i
+
1
]
designates the imaginary part of
a
[
i
]
.