MariaDB ATAN2() Function

In MariaDB, ATAN2() is a built-in numeric function that returns the arctangent of a given number.

MariaDB ATAN2() Syntax

Here is the syntax of the MariaDB ATAN2() function:

ATAN2(x, y)

Parameters

x, y

Required. The two numbers are used to calculate the arctangent. The signs of x and y are used to determine the quadrant of the result.

If you provide the wrong number of parameters, MariaDB will report an error: ERROR 1582 (42000): Incorrect parameter count in the call to native function 'ATAN2'.

Return value

The MariaDB ATAN2() function returns the arctangent of the specified value.

If any parameter is NULL, the ATAN2() function will return NULL.

MariaDB ATAN2() Examples

The following statement shows the basic usage of the MariaDB ATAN2() function:

SELECT
    ATAN2(2.5, 1),
    ATAN2(0.75, 1),
    ATAN2(-0.9, 2),
    ATAN2(PI(), 2),
    ATAN2(NULL)\G

Output:

*************************** 1\. row ***************************
 ATAN2(2.5, 1): 1.1902899496825317
ATAN2(0.75, 1): 0.6435011087932844
ATAN2(-0.9, 2): -0.4228539261329407
ATAN2(PI(), 2): 1.0038848218538872
   ATAN2(NULL): NULL

Conclusion

In MariaDB, ATAN2() is a built-in numeric function that returns the arctangent of a given number.