Type-generic math
De cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
O
<tgmath.h> cabeçalho inclui os cabeçalhos e <math.h> <complex.h> e define vários tipo genérico macros. Estas macros determina a função efectiva de chamar, dependendo dos tipos dos parâmetros.Original:
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.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Trigonométrica, poder, hiperbólica e funções exponenciais NJ
A
XXX macro tipo genérico chama um de:Original:
A type-generic macro
XXX calls either of:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- real função:Original:real function:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
floatvarianteXXXfOriginal:floatvariantXXXfThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.doublevarianteXXXOriginal:doublevariantXXXThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.long doublevarianteXXXlOriginal:long doublevariantXXXlThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
- função complexa:Original:complex function:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
floatvariantecXXXfOriginal:floatvariantcXXXfThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.doublevariantecXXXOriginal:doublevariantcXXXThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.long doublevariantecXXXlOriginal:long doublevariantcXXXlThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Uma exceção à regra acima é
exp (veja a tabela abaixo).Original:
An exception to the above rule is
exp (see the table below).The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
A função de chamada é determinado como se segue:
Original:
The function to call is determined as follows:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- Se qualquer um dos parâmetros é complexo, em seguida, a função complexa é chamada, caso contrário, a verdadeira função é chamada.Original:If any of the parameters is complex, then the complex function is called, otherwise the real function is called.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - Se qualquer um dos parâmetros é
long double, em seguida, a variantelong doubleé chamado. Caso contrário, se nenhum dos parâmetros édouble, em seguida, a variantedoubleé chamado. Caso contrário, é chamada variantefloat.Original:If any of the parameters islong double, then thelong doublevariant is called. Otherwise, if any of the parameters isdouble, then thedoublevariant is called. Otherwise,floatvariant is called.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - O comportamento é indefinido é qualquer um dos parâmetros é incompatível com o argumento da função correspondente.
Esta seção está incompleta
Motivo: what's meant by incompatible?Original:The behavior is undefined is any of the parameters is incompatible with the corresponding argument of the function.Esta seção está incompleta
Motivo: what's meant by incompatible?The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
As macros de tipo genérico são como se segue:
Original:
The type-generic macros are as follows:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
| 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 funções diversas
A
XXX macro tipo genérico chama uma das variantes de uma função real:Original:
A type-generic macro
XXX calls either of the variants of a real function:The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
floatvarianteXXXfOriginal:floatvariantXXXfThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.doublevarianteXXXOriginal:doublevariantXXXThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.long doublevarianteXXXlOriginal:long doublevariantXXXlThe text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Note, não há
modf macro tipo genérico.Original:
Note, there's no
modf type-generic macro.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
A função de chamada é determinado como se segue:
Original:
The function to call is determined as follows:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
- Se qualquer um dos parâmetros é
long double, em seguida, a variantelong doubleé chamado. Caso contrário, se nenhum dos parâmetros édouble, em seguida, a variantedoubleé chamado. Caso contrário, é chamada variantefloat.Original:If any of the parameters islong double, then thelong doublevariant is called. Otherwise, if any of the parameters isdouble, then thedoublevariant is called. Otherwise,floatvariant is called.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions. - O comportamento é indefinido é qualquer um dos parâmetros é incompatível com o argumento da função correspondente.
Esta seção está incompleta
Motivo: what's meant by incompatible?Original:The behavior is undefined is any of the parameters is incompatible with the corresponding argument of the function.Esta seção está incompleta
Motivo: what's meant by incompatible?The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Exemplo
int i;
float f;
double d;
long double ld;
float complex fc;
double complex dc;
long double complex ldc;
// macro -> function call
cos(i); // -> cos(i)
sin(f); // -> sinf(f)
acos(d); // -> acos(d)
sqrt(dc); // -> csqrt(dc);