Skip to main content

COSH

Description

Returns the hyperbolic cosine of x.

Syntax

COSH(<x>)

Parameters

ParameterDescription
<x>The value for which the hyperbolic cosine is to be calculated

Return Value

The hyperbolic cosine of parameter x

Special Cases

  • When x is NaN, returns NaN
  • When x is positive infinity, returns Infinity
  • When x is negative infinity, returns Infinity
  • When x is NULL, returns NULL

Examples

select cosh(0);
+-------------------------+
| cosh(cast(0 as DOUBLE)) |
+-------------------------+
| 1.0 |
+-------------------------+
select cosh(1);
+-------------------------+
| cosh(cast(1 as DOUBLE)) |
+-------------------------+
| 1.543080634815244 |
+-------------------------+
select cosh(-1);
+--------------------------+
| cosh(cast(-1 as DOUBLE)) |
+--------------------------+
| 1.543080634815244 |
+--------------------------+
select cosh(cast('nan' as double));
+-----------------------------+
| cosh(cast('nan' AS DOUBLE)) |
+-----------------------------+
| NaN |
+-----------------------------+
select cosh(cast('inf' as double));
+-----------------------------+
| cosh(cast('inf' AS DOUBLE)) |
+-----------------------------+
| Infinity |
+-----------------------------+
select cosh(cast('-inf' as double));
+------------------------------+
| cosh(cast('-inf' AS DOUBLE)) |
+------------------------------+
| Infinity |
+------------------------------+