Type-generic math
来自cppreference.com
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
头
<tgmath.h>
包括头<math.h>
<complex.h>
,并定义了几种类型的通用宏。这些宏确定实际要调用的函数的参数的类型.原文:
The header
<tgmath.h>
includes the headers <math.h>
and <complex.h>
and defines several type-generic macros. These macros determines the actual function to call depending on the types of the parameters.[编辑] 三角函数,双曲线,指数函数NJ
A型通用宏
XXX
调用原文:
A type-generic macro
XXX
calls either of:- 真正的功能
- long double变种
XXXl
- 复杂的功能
- long double变种
cXXXl
上述规则的一个例外是
exp
(请参阅下表)原文:
An exception to the above rule is
exp
(see the table below).调用的函数如下:
原文:
The function to call is determined as follows:
- 如果任何参数是复杂的,那么复杂的函数被调用,否则,真正的函数被调用.原文:If any of the parameters is complex, then the complex function is called, otherwise the real function is called.
- 如果任何参数是long double,然后long double变种被调用。否则,如果任何参数是double,然后被称为double变种。否则,float的变体被称为.原文:If any of the parameters is long double, then the long double variant is called. Otherwise, if any of the parameters is double, then the double variant is called. Otherwise, float variant is called.
- 的行为是未定义的参数与相应的函数的参数是不兼容的。
本章尚未完成
原因:what's meant by incompatible?原文:The behavior is undefined is any of the parameters is incompatible with the corresponding argument of the function.本章尚未完成
原因:what's meant by incompatible?
类型通用的宏如下:
原文:
The type-generic macros are as follows:
Type-generic macro | Real function variants |
Complex function variants | ||||
---|---|---|---|---|---|---|
float |
double |
long double |
float |
double |
long double | |
asin | asinf | asin | asinl | casinf | casin | casinl |
acos | acosf | acos | acosl | cacosf | cacos | cacosl |
atan | atanf | atan | atanl | catanf | catan | catanl |
asinh | asinhf | asinh | asinhl | casinhf | casinh | casinhl |
acosh | acoshf | acosh | acoshl | cacoshf | cacosh | cacoshl |
atanh | atanhf | atanh | atanhl | catanhf | catanh | catanhl |
sin | sinf | sin | sinl | csinf | csin | csinl |
cos | cosf | cos | cosl | ccosf | ccos | ccosl |
tan | tanf | tan | tanl | ctanf | ctan | ctanl |
sinh | sinhf | sinh | sinhl | csinhf | csinh | csinhl |
cosh | coshf | cosh | coshl | ccoshf | ccosh | ccoshl |
tanh | tanhf | tanh | tanhl | ctanhf | ctanh | ctanhl |
exp | expf | exp | expl | cexpf | cexp | cexpl |
log | logf | log | logl | clogf | clog | clogl |
pow | powf | pow | powl | cpowf | cpow | cpowl |
sqrt | sqrtf | sqrt | sqrtl | csqrtf | csqrt | csqrtl |
abs | fabsf | fabs | fabsl | cabsf | cabs | cabsl |
exp | expf | exp | expl | cexpf | cexp | cexpl |
[编辑] 其它功能NJ
A型通用宏
XXX
的变种,一个真正的函数调用原文:
A type-generic macro
XXX
calls either of the variants of a real function:- long double变种
XXXl
请注意,有没有
modf
类型通用的宏.原文:
Note, there's no
modf
type-generic macro.调用的函数如下:
原文:
The function to call is determined as follows:
- 如果任何参数是long double,然后long double变种被调用。否则,如果任何参数是double,然后被称为double变种。否则,float的变体被称为.原文:If any of the parameters is long double, then the long double variant is called. Otherwise, if any of the parameters is double, then the double variant is called. Otherwise, float variant is called.
- 的行为是未定义的参数与相应的函数的参数是不兼容的。
本章尚未完成
原因:what's meant by incompatible?原文:The behavior is undefined is any of the parameters is incompatible with the corresponding argument of the function.本章尚未完成
原因:what's meant by incompatible?