crealf, creal, creall
来自cppreference.com
                    
                                        
                    
                    
                                                            
                    |   定义于头文件  <complex.h>
  | 
||
|   float       crealf( float complex z );  | 
(1) | (C99 起) | 
|   double      creal( double complex z );  | 
(2) | (C99 起) | 
|   long double creall( long double complex z );  | 
(3) | (C99 起) | 
|   定义于头文件  <tgmath.h>
  | 
||
|   #define creal( z )  | 
(4) | (C99 起) | 
1-3) 返回 
z 的实部。4) 泛型宏:若 
z 拥有 long double complex 、 long double imaginary 或 long double 类型,则调用 creall 。若 z 拥有 float complex 、 float imaginary 或 float 类型,则调用 crealf。若z 拥有 double complex 、 double imaginary 或 double 类型,或任何整数类型,则调用 creal 。参数
| z | - | 复参数 | 
返回值
z的实部
此函数对所有可能输入指明,而且不受制于任何描述于 math_errhandling 的错误。
注意
对于任何复变量 z , z == creal(z) + I*cimag(z) 。
示例
运行此代码
输出:
1.000000+2.000000i
引用
- C11 standard (ISO/IEC 9899:2011):
 
- 7.3.9.6 The creal functions (p: 198-199)
 
- 7.25 Type-generic math <tgmath.h> (p: 373-375)
 
- G.7 Type-generic math <tgmath.h> (p: 545)
 
- C99 standard (ISO/IEC 9899:1999):
 
- 7.3.9.5 The creal functions (p: 180)
 
- 7.22 Type-generic math <tgmath.h> (p: 335-337)
 
- G.7 Type-generic math <tgmath.h> (p: 480)
 
参阅
|    (C99)(C99)(C99)  | 
  计算复数的虚部  (函数)  |