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)
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…
Step into a world where apps dance to the user's tune. Picture Instagram, a photo-sharing sensation that swept the globe.…
COVID-19 has led to a digitalization of lifestyle. As patients are taking their mental and physical health more seriously, healthcare…
Introduction WordPress, an immensely popular content management system (CMS), powers over 40% of the internet. What makes WordPress even more…
For moving companies trying to capture their market share amidst stiff competition, a tip or two about what they can…