<<<<<<< HEAD cosh | H2 | SQLDoc
Skip to main content

cosh

1. COSH Function

======= cosh | H2 Function | SQLDoc

cosh

1. COSH Function

>>>>>>> 9d19b1c8cb744c8e86d5c15b74d8b5f719ad62be

The COSH function in H2 database is used to calculate the hyperbolic cosine of a given value.

2. Syntax

The syntax for the COSH function in H2 database is as follows:

COSH(value)

Arguments

  • value: The value for which the hyperbolic cosine needs to be calculated. It should be a numeric value.

Return

  • The COSH function returns the hyperbolic cosine of the given value.

3. Notes

  • The COSH function in H2 database expects the input value to be a number.
  • If the input value is not a number or exceeds the numeric range, the COSH function will return NULL.
  • Make sure to use the correct syntax and datatype while using the COSH function to avoid errors.

4. Examples

Here are a few examples demonstrating the usage of the COSH function in H2 database:

Example 1 - Calculating the hyperbolic cosine of a value:

SELECT COSH(2) AS cosh_value;

Output:

cosh_value
----------
3.7621956910836314

Example 2 - Calculating the hyperbolic cosine of values stored in a column:

CREATE TABLE values (
id INT PRIMARY KEY,
val DOUBLE
);

INSERT INTO values VALUES (1, 0.5), (2, 1), (3, 1.5);

SELECT id, val, COSH(val) AS cosh_value
FROM values;

Output:

id | val |      cosh_value
---+-----+---------------------
1 | 0.5 | 1.1276259652063807
2 | 1 | 1.5430806348152437
3 | 1.5 | 2.3524096152432477
  • sinh - Calculate hyperbolic sine
  • tanh - Calculate hyperbolic tangent