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.

Dependencies

C: "km.h"

Examples

C interface:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    // 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, cosh(1.0) = %.15f\n", sinh, cosh);
    sinhcosh(b, &sinh,&cosh);
    printf("sinh(-1.0) = %.15f, cosh(-1.0) = %.15f\n", sinh, cosh);
    sinhcosh(c, &sinh,&cosh);
    printf("sinh(0.0) = %.15f, cosh(0.0) = %.15f\n", sinh, cosh);
    sinhcosh(d, &sinh,&cosh);
    printf("sinh(-0.0) = %.15f, cosh(-0.0) = %.15f\n", sinh, cosh);
    sinhcosh(e, &sinh,&cosh);
    printf("sinh(INFINITY) = %.15f, cosh(INFINITY) = %.15f\n", sinh, cosh);
    sinhcosh(f, &sinh,&cosh);
    printf("sinh(-INFINITY) = %.15f, cosh(-INFINITY) =  %.15f\n", sinh, cosh);
    sinhcosh(g, &sinh,&cosh);
    printf("sinh(NAN) = %.15f, cosh(NAN) = %.15f\n", sinh, cosh);
    /* 
     * sinh(1.0) = 1.175201193643801, cosh(1.0) = 1.543080634815244
     * sinh(-1.0) = -1.175201193643801, cosh(-1.0) = 1.543080634815244
     * sinh(0.0) = 0.000000000000000, cosh(0.0) = 1.000000000000000
     * sinh(-0.0) = -0.000000000000000, cosh(-0.0) = 1.000000000000000
     * sinh(INFINITY) = inf, cosh(INFINITY) = inf
     * sinh(-INFINITY) = -inf, cosh(-INFINITY) =  inf
     * sinh(NAN) = nan, cosh(NAN) = nan
     * 
     * */