Skip to main content

radians

1. RADIANS Function

The RADIANS function in H2 database is used to convert an angle from degrees to radians.

2. Syntax

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

RADIANS(angle)

Arguments

  • angle: The angle in degrees that needs to be converted to radians. It should be a numeric value.

Return

  • The RADIANS function returns the angle converted to radians.

3. Notes

  • The RADIANS function in H2 database expects the angle to be in degrees.
  • If the input angle is not a number or exceeds the numeric range, the RADIANS function will return NULL.
  • Ensure that you use the correct syntax and provide the angle in degrees while using the RADIANS function to avoid errors.

4. Examples

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

Example 1 - Converting 45 degrees to radians:

SELECT RADIANS(45) AS radians;

Output:

radians
------------------
0.7853981633974483

Example 2 - Converting angles stored in a column to radians:

CREATE TABLE angles (
id INT PRIMARY KEY,
degree DOUBLE
);

INSERT INTO angles VALUES (1, 30), (2, 60), (3, 90);

SELECT id, degree, RADIANS(degree) AS radians
FROM angles;

Output:

id | degree |         radians
---+--------+------------------------
1 | 30 | 0.5235987755982988
2 | 60 | 1.0471975511965979
3 | 90 | 1.5707963267948966
  • tan - Calculate tangent
  • sin - Calculate sine
  • cos - Calculate cosine