With MySQL, we can do complex calculations very easily with the help of inbuilt mathematical functions. ATAN() helps in getting the arc tangent of the input number. Now let’s start with these.
ATAN(number) is a mathematical function. It returns the arc tangent of a number.
It returns NULL, if input is passed as NULL.
It returns Warning, if any string argument is passed.
Name, Required /Optional, Type, Description
number, Required, Double, It represents a valid number.
Return, Description
NULL, if the argument is NULL.
Double, It returns the arc tangent of the input number.
Below is a very easy example. See the value when we pass the input as 0.
mysql> SELECT ATAN(0); +---------+ | ATAN(0) | +---------+ | 0 | +---------+ 1 row in set (0.00 sec)
See the value when we pass the input as 1.
mysql> SELECT ATAN(1); +--------------------+ | ATAN(1) | +--------------------+ | 0.7853981633974483 | +--------------------+ 1 row in set (0.00 sec)
See the value when we pass the input as -1.
mysql> SELECT ATAN(-1); +---------------------+ | ATAN(-1) | +---------------------+ | -0.7853981633974483 | +---------------------+ 1 row in set (0.00 sec)
Below are some more examples.
mysql> SELECT ATAN(2.5); +--------------------+ | ATAN(2.5) | +--------------------+ | 1.1902899496825317 | +--------------------+ 1 row in set (0.00 sec) mysql> SELECT ATAN(-2.5); +---------------------+ | ATAN(-2.5) | +---------------------+ | -1.1902899496825317 | +---------------------+ 1 row in set (0.00 sec)
See the below example :
mysql> SELECT ATAN('test'); +--------------+ | ATAN('test') | +--------------+ | 0 | +--------------+ 1 row in set, 1 warning (0.00 sec) mysql> SHOW WARNINGS; +---------+------+------------------------------------------+ | Level | Code | Message | +---------+------+------------------------------------------+ | Warning | 1292 | Truncated incorrect DOUBLE value: 'test' | +---------+------+------------------------------------------+ 1 row in set (0.00 sec)
You can see the warning message with the help of the ‘SHOW WARNINGS’ command. Please refer above code for the same.
If the argument is NULL, it will return NULL. See the below example :
mysql> SELECT ATAN(NULL); +------------+ | ATAN(NULL) | +------------+ | NULL | +------------+ 1 row in set (0.00 sec)
Here are some more examples to use the expression with the ATAN() function :
mysql> SELECT ATAN(.5); +--------------------+ | ATAN(.5) | +--------------------+ | 0.4636476090008061 | +--------------------+ 1 row in set (0.00 sec)
Now, we will get the same value if we pass the .5 as (.2+.3). See the below screen
mysql> SELECT ATAN(.2+.3); +--------------------+ | ATAN(.2+.3) | +--------------------+ | 0.4636476090008061 | +--------------------+ 1 row in set (0.00 sec)
Similarly for expression (-.2+.3) = .1. You can see in the below screen that both inputs yield the same results.
mysql> SELECT (.2*.3); +---------+ | (.2*.3) | +---------+ | 0.06 | +---------+ 1 row in set (0.00 sec) mysql> SELECT ATAN(.2*.3); +---------------------+ | ATAN(.2*.3) | +---------------------+ | 0.05992815512120788 | +---------------------+ 1 row in set (0.00 sec) mysql> SELECT ATAN(.06); +---------------------+ | ATAN(.06) | +---------------------+ | 0.05992815512120788 | +---------------------+ 1 row in set (0.00 sec)
We are getting the same values when we are using expressions, rather than using the number directly.
When it comes to children, there’s one universal truth: the right toy can spark imagination, build skills, and make memories…
In today’s digital age, where screens and gadgets dominate our children’s lives, there’s something heartwarming about a well-loved plush toy…
In a world dominated by screens and fast-paced routines, it’s easy to forget the simple magic of a toy in…
In the heart of Delhi’s vibrant streets lies a world where imagination meets innovation — the magical universe of toys.…
When was the last time a toy truly amazed you—not just as a product, but as a thoughtful tool for…
In the digital age, the way we experience childhood has changed, but the essence remains the same—imagination, exploration, and joy.…