MySQL ACOS() Function: Calculate inverse cosine

ACOS() returns an angle in radians whose cosine matches the supplied value. Its valid input range is -1 through 1.

ACOS(): Quick SQL Example

Run this SELECT query directly in MySQL or phpMyAdmin. It uses fixed inputs so you can verify the result without creating a table.

SELECT DEGREES(ACOS(0)) AS angle_degrees;
angle_degrees
90
On this page — Show page sectionsHide page sections

More SQL Examples and Explanations

ACOS(X) returns the arc cosine of X in radians. The input must be between -1 and 1; values outside that range return NULL.

SELECT ACOS(0); -- Output: 1.5707963267948966
SELECT ACOS(1); -- Output: 0
SELECT ACOS(-2); -- Output: NULL

Using ROUND() with ACOS()

SELECT ROUND(ACOS(0), 2); -- Output: 1.57

Syntax

SELECT ACOS(X);

The result is the angle whose cosine is X. Use DEGREES() when you want degrees instead of radians.

ACOS() with DEGREES()

SELECT DEGREES(ACOS(0)); -- Output: 90
SELECT DEGREES(ACOS(1)); -- Output: 0
SELECT DEGREES(ACOS(-1)); -- Output: 180

How to Interpret the Result

ACOS() normally returns radians. Use DEGREES() if the angle should be displayed in degrees.

Common Question

What happens when the input is outside -1 to 1?
ACOS() returns NULL for an out-of-range input.

Related: ATAN()

↑ Back to top




Subscribe to our YouTube Channel here



plus2net.com




SQL Video Tutorials










✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer