Skip to main content

atan

1. ATAN Function

The ATAN function in H2 database is used to calculate the arctangent of a given number.

2. Syntax

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

ATAN(number)

Arguments

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

Return

  • The ATAN function returns the arctangent of the given number in radians.

3. Notes

  • The ATAN function in H2 database calculates the arctangent of a number and returns the result in radians.
  • The input number should be a numeric value. If the number is not a valid numeric value, the ATAN function will return NULL.
  • Make sure to use the correct syntax and datatype while using the ATAN function to avoid errors.

4. Examples

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

Example 1 - Calculating the arctangent of a number:

SELECT ATAN(0.5) AS arctangent;

Output:

arctangent
----------
0.4636476090008061

Example 2 - Calculating the arctangent of numbers stored in a column:

CREATE TABLE numbers (
id INT PRIMARY KEY,
value DOUBLE
);

INSERT INTO numbers VALUES (1, 0.2), (2, 0.5), (3, 1);

SELECT id, value, ATAN(value) AS arctangent
FROM numbers;

Output:

id | value |      arctangent
---+-------+------------------
1 | 0.2 | 0.1973955598498808
2 | 0.5 | 0.4636476090008061
3 | 1 | 0.7853981633974483
  • tan - Calculate tangent
  • atan2 - Calculate arctangent of two numbers