w3resource

MySQL ACOS() function

ACOS() function

MySQL ACOS() returns the arc cosine of a number. The function returns NULL when the value of the number is not between the range -1 to 1.

Syntax:

ACOS(N)

Argument:

Name Description
N A number whose arc cosine value is to be retrieved.

Syntax Diagram:

MySQL ACOS() Function - Syntax Diagram

MySQL Version: 5.6


Example:

Code:

SELECT ACOS(1);

Explanation:

The above MySQL statement will return the cosine value of the number defined as an argument.

Sample Output:

mysql> SELECT ACOS(1);
+---------+
| ACOS(1) |
+---------+
|       0 | 
+---------+
1 row in set (0.02 sec)

Example : ACOS() function using fractional number

Code:

SELECT ACOS(1.001);

Explanation:

The above MySQL statement will return NULL because the value defined in the argument is greater than the range.

Sample Output:

mysql> SELECT ACOS(1.001);
+-------------+
| ACOS(1.001) |
+-------------+
|        NULL | 
+-------------+
1 row in set (0.00 sec)

Example: ACOS() function using zero(0)

Code:

 SELECT ACOS(0);

Explanation:

The above MySQL statement will return the cosine value of the number defined as an argument.

Sample Output:

mysql> SELECT ACOS(0);
+-----------------+
| ACOS(0)         |
+-----------------+
| 1.5707963267949 | 
+-----------------+
1 row in set (0.00 sec) 

All Mathematical Functions

MySQL Mathematical Functions, slide presentation

Previous: ABS()
Next: ASIN()



Follow us on Facebook and Twitter for latest update.




We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook