Namespaces
Variants
Views
Actions

sinh

From cppreference.com
< c‎ | numeric‎ | math
 
 
 
Common mathematical functions
Functions
Basic operations
(C99)
(C99)
(C99)
(C99)
(C99)
(C99)(C99)(C99)
Exponential functions
(C99)
(C99)
(C99)
(C99)
Power functions
(C99)
(C99)
Trigonometric and hyperbolic functions
sinh
(C99)
(C99)
(C99)
Error and gamma functions
(C99)
(C99)
(C99)
(C99)
Nearest integer floating point operations
(C99)(C99)(C99)
(C99)
(C99)(C99)(C99)
Floating point manipulation functions
(C99)(C99)
(C99)
(C99)
Classification
(C99)
(C99)
(C99)
Macro constants
 
Defined in header <math.h>
float       sinhf( float arg );
(since C99)
double      sinh( double arg );
long double sinhl( long double arg );
(since C99)

Computes hyperbolic sine of arg

Contents

[edit] Parameters

arg - floating point value

[edit] Return value

Hyperbolic sine of arg

[edit] Example

#include <stdio.h>
#include <math.h>
#include <errno.h>
#include <fenv.h>
#include <float.h>
#include <string.h>
 
#pragma STDC FENV_ACCESS ON
 
void show_fe_exceptions(void)
{
    printf("current exceptions raised: ");
    if(fetestexcept(FE_DIVBYZERO))     printf(" FE_DIVBYZERO");
    if(fetestexcept(FE_INEXACT))       printf(" FE_INEXACT");
    if(fetestexcept(FE_INVALID))       printf(" FE_INVALID");
    if(fetestexcept(FE_OVERFLOW))      printf(" FE_OVERFLOW");
    if(fetestexcept(FE_UNDERFLOW))     printf(" FE_UNDERFLOW");
    if(fetestexcept(FE_ALL_EXCEPT)==0) printf(" none");
    printf("\n");
}
 
int main(void)
{
    printf("sinh(0.5)       = %f\n",    sinh(0.5));
    printf("asinh(0.521095) = %f\n",    asinh(0.521095));   /* inverse of sinh */
    printf("sinh(+0.0)      = %+.1f\n", sinh(+0.0));
    printf("sinh(-0.0)      = %+.1f\n", sinh(-0.0));
    printf("sinh(+INFINITY) = %+.1f\n", sinh(+INFINITY));
    printf("sinh(-INFINITY) = %+.1f\n", sinh(-INFINITY));
    printf("sinh(NAN)       = %f\n",    sinh(NAN));
    printf("\n");
 
    /* range error                                        */
    /* "inexact" and "overflow" floating-point exceptions */
    errno = 0; feclearexcept(FE_ALL_EXCEPT);
    printf("sinh(DBL_MAX)   = %f\n",   sinh(DBL_MAX));
    printf("%s\n",strerror(errno));
    show_fe_exceptions();
 
    return 0;
}

Possible output:

sinh(0.5)       = 0.521095
asinh(0.521095) = 0.500000
sinh(+0.0)      = +0.0
sinh(-0.0)      = -0.0
sinh(+INFINITY) = +inf
sinh(-INFINITY) = -inf
sinh(NAN)       = nan
 
sinh(DBL_MAX)   = inf
Numerical result out of range
current exceptions raised:  FE_INEXACT FE_OVERFLOW

[edit] See also

computes hyperbolic cosine (ch(x))
(function) [edit]
hyperbolic tangent
(function) [edit]
(C99)
area hyperbolic sine
(function) [edit]