Rate This Document
Findability
Accuracy
Completeness
Readability

sinhcosh

Compute the hyperbolic sine and hyperbolic cosine of the input radian.

Interface Definition

C interface:

void sinhcoshf(float x, float *sinh, float *cosh);

void sinhcosh(double x, double *sinh, double *cosh);

Parameters

Parameter

Type

Description

Input/Output

x

  • For sinhcoshf, x is of single-precision floating-point type.
  • For sinhcosh, x is of double-precision floating-point type.

Floating-point value of a radian angle.

Input

sinh

  • For sinhcoshf, sinh is of single-precision floating-point pointer type.
  • For sinhcosh, sinh is of double-precision floating-point pointer type.

Hyperbolic sine.

If the pointer is null, an undefined behavior occurs, and the interface does not verify the output pointer.

Output

cosh

  • For sinhcoshf, cosh is of single-precision floating-point pointer type.
  • For sinhcosh, cosh is of double-precision floating-point pointer type.

Hyperbolic cosine.

If the pointer is null, an undefined behavior occurs, and the interface does not verify the output pointer.

Output

Return Value

  • The hyperbolic sine sinh and hyperbolic cosine cosh of radian angle x are returned. sinh ∈ [-∞, +∞], cosh ∈ [1, +∞]
  • If the input is +0, the hyperbolic sine is +0 and the hyperbolic cosine is +1.
  • If the input is -0, the hyperbolic sine is -0 and the hyperbolic cosine is +1.
  • If the input of sinhcoshf is greater than 0x1.8p6f, +∞ is returned for both the hyperbolic sine and hyperbolic cosine. If the input of sinhcosh is greater than 0x1.8p9, +∞ is returned for both the hyperbolic sine and hyperbolic cosine.
  • If the input of sinhcoshf is smaller than -0x1.8p6f, the returned hyperbolic sine is -∞ and the hyperbolic cosine is +∞. If the input of sinhcosh is smaller than -0x1.8p9, the returned hyperbolic sine is -∞ and the hyperbolic cosine is +∞.
  • If the absolute value of the input of sinhcoshf is smaller than 0x1.p-13, x is returned for the hyperbolic sine and 1.0 is returned for the hyperbolic cosine. If the absolute value of the input of sinhcosh is smaller than 0x1.p-26, x is returned for the hyperbolic sine and 1.0 is returned for the hyperbolic cosine.
  • If the input is ±∞, the hyperbolic sine is ±∞ and the hyperbolic cosine is +∞.
  • If the input is NaN, the sine and cosine are both NaN.

Dependency

C: "km.h"

Example

C interface:

    // typical usage
    double a = 1.0, b = -1.0, c = 0.0, d = -0.0;
    // special handling
    double e = INFINITY, f = -INFINITY, g = NAN;
    // print result
    double sinh, cosh;
    sinhcosh(a, &sinh, &cosh);
    printf("sinh(1.0) = %.15f, cos(1.0) = %.15f\n", sinh, cosh);
    sinhcosh(b, &sinh,&cosh);
    printf("sin(-1.0) = %.15f, cos(-1.0) = %.15f\n", sinh, cosh);
    sinhcosh(c, &sinh,&cosh);
    printf("sin(0.0) = %.15f, cos(0.0) = %.15f\n", sinh, cosh);
    sinhcosh(d, &sinh,&cosh);
    printf("sin(-0.0) = %.15f, cos(-0.0) = %.15f\n", sinh, cosh);
    sinhcosh(e, &sinh,&cosh);
    printf("sin(INFINITY) = %.15f, cos(INFINITY) = %.15f\n", sinh, cosh);
    sinhcosh(f, &sinh,&cosh);
    printf("sin(-INFINITY) = %.15f, cos(-INFINITY) =  %.15f\n", sinh, cosh);
    sinhcosh(g, &sinh,&cosh);
    printf("sin(NAN) = %.15f, cos(NAN) = %.15f\n", sinh, cosh);
    /* 
     * sinh(1.0) = 1.175201193643801, cos(1.0) = 1.543080634815244
     * sin(-1.0) = -1.175201193643801, cos(-1.0) = 1.543080634815244
     * sin(0.0) = 0.000000000000000, cos(0.0) = 1.000000000000000
     * sin(-0.0) = -0.000000000000000, cos(-0.0) = 1.000000000000000
     * sin(INFINITY) = inf, cos(INFINITY) = inf
     * sin(-INFINITY) = -inf, cos(-INFINITY) =  inf
     * sin(NAN) = nan, cos(NAN) = nan
     * 
     * */