?
This document uses PHP Chinese website manual Release
在頭文件<math.h>中定義 | ||
---|---|---|
float tanhf(float arg); | (1) | (自C99以來(lái)) |
double tanh(double arg); | (2) | |
long double tanhl(long double arg); | (3) | (自C99以來(lái)) |
在頭文件<tgmath.h>中定義 | ||
#define tanh(arg) | (4) | (自C99以來(lái)) |
1-3)計(jì)算arg的雙曲正切。
4)類型 - 泛型宏:如果參數(shù)的類型為long double,則調(diào)用tanhl。 否則,如果參數(shù)具有整數(shù)類型或類型double,則調(diào)用tanh。 否則,調(diào)用tanhf。 如果參數(shù)很復(fù)雜,那么宏調(diào)用相應(yīng)的復(fù)合函數(shù)(ctanhf,ctanh,ctanhl)。
ARG | - | 浮點(diǎn)值代表雙曲線角度 |
---|
如果沒(méi)有錯(cuò)誤發(fā)生,arg(tanh(arg)或者雙曲正切
| earg-e-arg |
|:----|
| earg+e-arg |
)被返回。
如果由于下溢而發(fā)生范圍錯(cuò)誤,則返回正確的結(jié)果(舍入后)。
按照math_errhandling中的指定報(bào)告錯(cuò)誤。
如果實(shí)現(xiàn)支持IEEE浮點(diǎn)運(yùn)算(IEC 60559),
如果參數(shù)為±0,則返回±0
如果參數(shù)為±∞,則返回±1
如果參數(shù)是NaN,則返回NaN
POSIX指定在發(fā)生下溢時(shí),arg
未經(jīng)修改就返回,如果不支持,則返回不大于DBL_MIN,F(xiàn)LT_MIN和LDBL_MIN的實(shí)現(xiàn)定義值。
#include <stdio.h>#include <math.h> int main(void){ printf("tanh(1) = %f\ntanh(-1) = %f\n", tanh(1), tanh(-1)); printf("tanh(0.1)*sinh(0.2)-cosh(0.2) = %f\n", tanh(0.1) * sinh(0.2) - cosh(0.2)); // special values printf("tanh(+0) = %f\ntanh(-0) = %f\n", tanh(0.0), tanh(-0.0));}
注意
tanh(1) = 0.761594tanh(-1) = -0.761594tanh(0.1)*sinh(0.2)-cosh(0.2) = -1.000000tanh(+0) = 0.000000tanh(-0) = -0.000000
C11標(biāo)準(zhǔn)(ISO / IEC 9899:2011):
7.12.5.6 tanh函數(shù)(p:242)
7.25類型通用數(shù)學(xué)<tgmath.h>(p:373-375)
F.10.2.6 tanh函數(shù)(p:520)
C99標(biāo)準(zhǔn)(ISO / IEC 9899:1999):
7.12.5.6 tanh函數(shù)(p:222-223)
7.22類型通用數(shù)學(xué)<tgmath.h>(p:335-337)
F.9.2.6 tanh函數(shù)(p:457)
C89 / C90標(biāo)準(zhǔn)(ISO / IEC 9899:1990):
4.5.3.3 tanh函數(shù)
sinhsinhfsinhl(C99)(C99) | 計(jì)算雙曲正弦函數(shù)(sh(x))(函數(shù)) |
---|---|
coshcoshfcoshl(C99)(C99) | 計(jì)算雙曲余弦(ch(x))(函數(shù)) |
atanhatanhfatanhl(C99)(C99)(C99) | 計(jì)算反雙曲正切(artanh(x))(函數(shù)) |
(C99)(C99)(C99) | 計(jì)算復(fù)數(shù)雙曲正切(函數(shù)) |
| tanh的C ++文檔 |