v?cosh
Compute the hyperbolic cosine of vector elements.
Interface Definition
C interface:
void vscosh(const int len, const float* src, float* dst);
void vdcosh(const int len, const double* src, double* dst);
Fortran interface:
CALL VSCOSH(LEN, SRC, DST);
CALL VDCOSH(LEN, SRC, DST);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
len |
Integer |
Number of elements in the input vector. If len ≤ 0, the system displays a message indicating that the value of len is invalid. |
Input |
src |
|
Input vector src with length len. If the pointer is null, the system prompts a null pointer error. |
Input |
dst |
|
Output vector dst with length len. If the pointer is null, the system prompts a null pointer error. |
Output |
Return Value
- The hyperbolic cosine y of radian angle x is returned for each operation value. y ∈ [1, +∞].
- If the input is ±0, the return value is +1.
- If the input value of coshf is greater than 0x1.8p6f, +∞ is returned. If the input value of cosh is greater than 0x1.8p9, +∞ is returned.
- If the input value of coshf is less than -0x1.8p6f, +∞ is returned. If the input value of cosh is less than -0x1.8p9, +∞ is returned.
- If the input is ±∞, the return value is +∞.
- If the input is NaN, the return value is NaN.
Dependencies
C: "kvml.h"
Fortran: "kvml.f03"
Examples
C interface:
int i, len = 4;
float src[len] = {0.0f, 2.0f, inf, nan};
float* dst = (float*)malloc(sizeof(float) * len);
if (dst == NULL) {
printf("Malloc Failed!\n");
return 0;
}
vscosh(len, src, dst);
/**
* Output dst:
* 1.0 3.762195691 inf nan
*
*/
Fortran interface:
INTEGER :: LEN = 4
REAL(4) SRC(4)
REAL(4) DST(4)
DATA SRC /1, 2, 3, 4/
CALL VSCOSH(LEN, SRC, DST)
!
! OUTPUT DST:
! 1.543080635, 3.762195691, 10.067661996, 27.308232836
!
Parent topic: Function Syntax