非常教程

C参考手册

数值 | Numerics

sinhf

在头文件<math.h>中定义

float sinhf(float arg);

(1)

(自C99以来)

double sinh(double arg);

(2)

long double sinhl(long double arg);

(3)

(自C99以来)

在头文件<tgmath.h>中定义

#define sinh(arg)

(4)

(自C99以来)

1-3)计算双曲正弦arg

4)类型 - 通用宏:如果参数具有类型long doublesinhl则被调用。否则,如果参数具有整数类型或类型doublesinh则调用该参数。否则,sinhf被调用。如果参数是复杂的,则宏调用相应的复变函数(csinhfcsinhcsinhl)。

参数

arg

-

浮点值代表双曲线角度

返回值

如果没有错误发生,arg(sinh(arg)或者双曲正弦

| earg-e-arg |

|:----|

| 2 |

)返回。

如果范围误差由于发生溢出,或返回±HUGE_VAL±HUGE_VALF,或±HUGE_VALL

如果由于下溢而发生范围错误,则返回正确的结果(舍入后)。

错误处理

按照math_errhandling中的指定报告错误。

如果实现支持IEEE浮点运算(IEC 60559),

  • 如果参数为±0或±∞,则不加修改地返回
  • 如果参数是NaN,则返回NaN

注意

POSIX指定在发生下溢时,arg未经修改就返回,如果不支持,则返回不大于DBL_MIN,FLT_MIN和LDBL_MIN的实现定义值。

示例

#include <stdio.h>
#include <math.h>
#include <errno.h>
#include <fenv.h>
 
#pragma STDC FENV_ACCESS ON
int main(void)
{
    printf("sinh(1) = %f\nsinh(-1)=%f\n", sinh(1), sinh(-1));
    printf("log(sinh(1) + cosh(1))=%f\n", log(sinh(1)+cosh(1)));
    // special values
    printf("sinh(+0) = %f\nsinh(-0)=%f\n", sinh(0.0), sinh(-0.0));
    // error handling 
    errno=0; feclearexcept(FE_ALL_EXCEPT);
    printf("sinh(710.5) = %f\n", sinh(710.5));
    if(errno == ERANGE) perror("    errno == ERANGE");
    if(fetestexcept(FE_OVERFLOW)) puts("    FE_OVERFLOW raised");
}

可能的输出:

sinh(1) = 1.175201
sinh(-1)=-1.175201
log(sinh(1) + cosh(1))=1.000000
sinh(+0) = 0.000000
sinh(-0)=-0.000000
sinh(710.5) = inf
    errno == ERANGE: Numerical result out of range
    FE_OVERFLOW raised

参考

  • C11标准(ISO/IEC 9899:2011):
    • 7.12.5.5 sinh函数(p:241-242)
    • 7.25类型通用数学<tgmath.h>(p:373-375)
    • F.10.2.5 sinh函数(p:520)
  • C99标准(ISO/IEC 9899:1999):
    • 7.12.5.5 sinh函数(p:222)
    • 7.22类型通用数学<tgmath.h>(p:335-337)
    • F.9.2.5 sinh函数(p:457)
  • C89/C90标准(ISO/IEC 9899:1990):
    • 4.5.3.2 sinh函数

另请参阅

coshcoshfcoshl(C99)(C99)

计算双曲余弦(ch(x))(函数)

tanhtanhftanhl(C99)(C99)

计算双曲正切(函数)

asinhasinhfasinhl(C99)(C99)(C99)

计算反双曲正弦(arsinh(x))(函数)

csinhcsinhfcsinhl(C99)(C99)(C99)

计算复数双曲正弦函数(函数)

| C ++文档sinh |

C

C 语言是一门通用计算机编程语言,应用广泛。C 语言的设计目标是提供一种能以简易的方式编译、处理低级存储器、产生少量的机器码以及不需要任何运行环境支持便能运行的编程语言。