With MySQL, we can do complex calculations very easily with the help of inbuilt mathematical functions. ACOS(number) helps in getting the angle, in radians, whose sine is provided as input number. Now let’s start with these.
ACOS(number) is a mathematical function. It returns the arc cosine of number, that is, the value whose cosine is number. It returns NULL, if N is not in the range -1.00 to 1.00.
It returns Warning, if any string argument is passed.
Name, Required /Optional,Type, Description
number , Required, Double , It represents valid number between -1 and 1.
Return, Description
NULL, if the argument is NULL.
Double, It returns arc cosine of number.
See the below example. What it returns when 0 is passed.
mysql> select ACOS(0); +--------------------+ | ACOS(0) | +--------------------+ | 1.5707963267948966 | +--------------------+ 1 row in set (0.00 sec)
See the below value When -1 is passed as an input.
mysql> select ACOS(-1); +-------------------+ | ACOS(-1) | +-------------------+ | 3.141592653589793 | +-------------------+ 1 row in set (0.00 sec)
See the below value When 1 is passed as an input.
mysql> select ACOS(1); +---------+ | ACOS(1) | +---------+ | 0 | +---------+ 1 row in set (0.00 sec)
Below are some more examples.
mysql> SELECT ACOS(.13256); +--------------------+ | ACOS(.13256) | +--------------------+ | 1.4378449969525082 | +--------------------+ 1 row in set (0.00 sec) mysql> SELECT ACOS(-.13256); +-------------------+ | ACOS(-.13256) | +-------------------+ | 1.703747656637285 | +-------------------+ 1 row in set (0.00 sec)
See the below example :
mysql> SELECT ACOS('TEST123'); +--------------------+ | ACOS('TEST123') | +--------------------+ | 1.5707963267948966 | +--------------------+ 1 row in set, 1 warning (0.00 sec) mysql> SHOW WARNINGS; +---------+------+---------------------------------------------+ | Level | Code | Message | +---------+------+---------------------------------------------+ | Warning | 1292 | Truncated incorrect DOUBLE value: 'TEST123' | +---------+------+---------------------------------------------+ 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 ACOS(NULL); +------------+ | ACOS(NULL) | +------------+ | NULL | +------------+ 1 row in set (0.00 sec)
It will return NULL if the values which are passed are out of range values.
mysql> SELECT ACOS(2.5698); +--------------+ | ACOS(2.5698) | +--------------+ | NULL | +--------------+ 1 row in set (0.00 sec) mysql> SELECT ACOS(-72.5698); +----------------+ | ACOS(-72.5698) | +----------------+ | NULL | +----------------+ 1 row in set (0.00 sec)
Here are some more examples to use the expression with the ACOS() function :
mysql> SELECT ACOS(.5); +--------------------+ | ACOS(.5) | +--------------------+ | 1.0471975511965979 | +--------------------+ 1 row in set (0.00 sec)
We are using an expression in the below example for the above number as (.2+.3) becomes .5. So, We have got the same value.
mysql> SELECT ACOS(.2+.3); +--------------------+ | ACOS(.2+.3) | +--------------------+ | 1.0471975511965979 | +--------------------+ 1 row in set (0.00 sec)
You can see, We have got 0.06 in the below example.
mysql> SELECT (.2*.3); +---------+ | (.2*.3) | +---------+ | 0.06 | +---------+ 1 row in set (0.00 sec)
We are using an expression in the below example for the above number as (.2*.3) becomes 0.06. So, We have got the same value.
mysql> SELECT ACOS(.2*.3); +--------------------+ | ACOS(.2*.3) | +--------------------+ | 1.5107602683496182 | +--------------------+ 1 row in set (0.00 sec) mysql> SELECT ACOS(0.06); +--------------------+ | ACOS(0.06) | +--------------------+ | 1.5107602683496182 | +--------------------+ 1 row in set (0.00 sec)
Toys have always played a crucial role in childhood, fueling imagination, creativity, and learning. Whether you're looking for educational playsets,…
Toys are an essential part of childhood, shaping creativity, learning, and fun-filled memories. Whether it’s the soft embrace of plush…
Toys are a gateway to imagination, creativity, and learning. Whether it’s a child’s first plush toy, a set of engaging…
Toys are more than just playthings; they help children explore, learn, and develop essential life skills. From interactive sensory toys…
Toys are more than just playthings; they are tools that foster creativity, motor skills, and cognitive development in children. From…
Toys play an integral role in a child’s growth and development. They spark creativity, encourage learning, and provide endless hours…