Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Retrieves the real part of a complex number.
Syntax
double creal( _Dcomplex z );
float crealf( _Fcomplex z );
long double creall( _Lcomplex z );
#define creal(X) // Requires C11 or higher
float creal( _Fcomplex z ); // C++ only
long double creal( _Lcomplex z ); // C++ only
Parameters
z
A complex number.
Return value
The real part of z
.
Remarks
Because C++ allows overloading, you can call overloads of creal
that take _Fcomplex
or _Lcomplex
values, and return float
or long double
values. In a C program, unless you're using the <tgmath.h> macro to call this function, creal
always takes a _Dcomplex
value and returns a double
value.
If you use the <tgmath.h> creal()
macro, the type of the argument determines which version of the function is selected. See Type-generic math for details.
Requirements
Routine | C header | C++ header |
---|---|---|
creal , crealf , creall |
<complex.h> | <ccomplex> |
creal macro |
<tgmath.h> |
The _Fcomplex
, _Dcomplex
, and _Lcomplex
types are Microsoft-specific equivalents of the unimplemented native C99 types float _Complex, double _Complex, and long double _Complex, respectively. For more compatibility information, see Compatibility.
See also
Alphabetical function reference
_Cbuild
, _FCbuild
, _LCbuild
norm
, normf
, norml
cproj
, cprojf
, cprojl
conj
, conjf
, conjl
cimag
, cimagf
, cimagl
carg
, cargf
, cargl
cabs
, cabsf
, cabsl