| title | sinh, sinhf, sinhl | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| description | API reference for calculating the hyperbolic sine of a floating-point value. | |||||||||||
| ms.date | 1/15/2021 | |||||||||||
| api_name |
|
|||||||||||
| api_location |
|
|||||||||||
| api_type |
|
|||||||||||
| topic_type |
|
|||||||||||
| f1_keywords |
|
|||||||||||
| helpviewer_keywords |
|
Calculates the hyperbolic sine.
double sinh(double x);
float sinhf(float x);
long double sinhl(long double x);
#define sinh(x) // Requires C11 or later
float sinh(float x); // C++ only
long double sinh(long double x); // C++ onlyx
Angle in radians.
The sinh functions return the hyperbolic sine of x. By default, if the result is too large, sinh sets errno to ERANGE and returns ±HUGE_VAL.
| Input | SEH exception | _matherr exception |
|---|---|---|
| ± QNaN, IND | None | _DOMAIN |
| ` | x | ≥ 7.104760e+002` |
For more information about return codes, see errno, _doserrno, _sys_errlist, and _sys_nerr.
Because C++ allows overloading, you can call overloads of sinh that take and return float or long double values. In a C program, unless you're using the <tgmath.h> macro to call this function, sinh always takes and returns double.
If you use the sinh macro from <tgmath.h>, the type of the argument determines which version of the function is selected. See Type-generic math for details.
By default, this function's global state is scoped to the application. To change this behavior, see Global state in the CRT.
| Routine | Required header (C) | Required header (C++) |
|---|---|---|
sinh, sinhf, sinhl |
<math.h> |
<cmath> or <math.h> |
sinh macro |
<tgmath.h> |
For more compatibility information, see Compatibility.
// crt_sinhcosh.c
// This program displays the hyperbolic
// sine and hyperbolic cosine of pi / 2.
// Compile by using: cl /W4 crt_sinhcosh.c
#include <math.h>
#include <stdio.h>
int main( void)
{
double pi = 3.1415926535;
double x, y;
x = pi / 2;
y = sinh( x );
printf( "sinh( %f ) = %f\n",x, y );
y = cosh( x );
printf( "cosh( %f ) = %f\n",x, y );
}sinh( 1.570796 ) = 2.301299
cosh( 1.570796 ) = 2.509178
Math and floating-point support
acosh, acoshf, acoshl
asinh, asinhf, asinhl
atanh, atanhf, atanhl
cosh, coshf, coshl
tanh, tanhf, tanhl