With MySQL, we can do complex calculations very easily with the help of inbuilt mathematical functions. COT(number) helps in getting the cotangent value.
Now let’s start with it.
COT(X) is a mathematical function. It returns the cotangent of number X. Where X is the argument, whose value will be passed by the user.
It returns NULL, if X is passed as NULL.
It returns Error, if any String argument or Zero 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 arc cotangent of number.
See the below example. See the output, when 12 is passed.
mysql> SELECT COT(12); +---------------------+ | COT(12) | +---------------------+ | -1.5726734063976893 | +---------------------+ 1 row in set (0.00 sec)
Now, Let’s change the input value to 56. See what it returns.
mysql> SELECT COT(56); +---------------------+ | COT(56) | +---------------------+ | -1.6359284217814665 | +---------------------+ 1 row in set (0.00 sec)
See the below value When 1 is passed as an input.
mysql> SELECT COT(1); +--------------------+ | COT(1) | +--------------------+ | 0.6420926159343306 | +--------------------+ 1 row in set (0.00 sec)
We are using the PI() function to get the value of cotangent with it. I get the below value.
mysql> SELECT COT(PI()); +-----------------------+ | COT(PI()) | +-----------------------+ | -8.165619676597685e15 | +-----------------------+ 1 row in set (0.00 sec)
Below are some more examples.
mysql> SELECT COT(29.56); +--------------------+ | COT(29.56) | +--------------------+ | 0.2931169938865947 | +--------------------+ 1 row in set (0.00 sec) mysql> SELECT COT(-29.56); +---------------------+ | COT(-29.56) | +---------------------+ | -0.2931169938865947 | +---------------------+ 1 row in set (0.01 sec) mysql> SELECT COT(156.89); +--------------------+ | COT(156.89) | +--------------------+ | -5.209989733425108 | +--------------------+ 1 row in set (0.01 sec) mysql> SELECT COT(-156.89); +-------------------+ | COT(-156.89) | +-------------------+ | 5.209989733425108 | +-------------------+ 1 row in set (0.00 sec)
COT(0), when zero is passed as an input string it will show an error.
mysql> SELECT COT(0); ERROR 1690 (22003): DOUBLE value is out of range in 'cot(0)'
See the below example :
mysql> SELECT COT('test'); ERROR 1690 (22003): DOUBLE value is out of range in 'cot('test')' mysql> SHOW ERRORS; +-------+------+-----------------------------------------------+ | Level | Code | Message | +-------+------+-----------------------------------------------+ | Error | 1690 | DOUBLE value is out of range in 'cot('test')' | +-------+------+-----------------------------------------------+ 1 row in set (0.00 sec)
You can see the ERROR message details with the help of the ‘SHOW ERRORS’ command. Please refer above code for the same.
If the argument is NULL, it will return NULL. See the below example :
mysql> SELECT COT(NULL); +-----------+ | COT(NULL) | +-----------+ | NULL | +-----------+ 1 row in set (0.00 sec)
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…
App usage is growing steadily without showing any signs of slowing down. Hence, it is no surprise that mobile applications…
As the world has grown more digital, businesses have adapted themselves. An effectual adaptation includes online advertising. Offline advertising styles…