ACOS

ACOS is a mathematical function provided by SQL. It computes the arc cosine of a specified number. The result of this function is an angle, expressed in radians, between the positive x-axis and the point on the unit circle that corresponds to the specified number.

ACOS(X)Where X is a numeric value between -1 and 1, representing the cosine of the angle.

  • x: A numeric value ranging between -1 and 1 that represents the cosine of the angle for which the arc cosine is computed in MySQL’s ACOS(X) function.

Example

SELECT ACOS(0.5);

Output

1.0471975511966

Explanation

This example demonstrates the ACOS function in MySQL. ACOS function returns the arc cosine of a number; applied to 0.5, it returns approximately 1.0471975511966.

ACOS(double precision) returns double precision

  • double precision: This parameter represents a double precision floating-point number for which you are trying to calculate the arc cosine. The value should be within the range of -1 to 1. If the value is outside this range, the function will return “NaN”.

Example

SELECT ACOS(0.5);

Output

1.0471975511966

Explanation

The ACOS function in PostgreSQL returns the arc cosine of a number. In the example, ACOS(0.5) returns 1.0471975511966, which is radian value of the arc cosine of 0.5.

ACOS(float_expression)

  • float_expression: This parameter represents a floating-point numeric value from which SQL Server derives the arccosine, or inverse cosine. Any number between -1 and 1 can be used for this parameter. If the number falls outside this range, SQL Server returns NULL. The datatype for float_expression must be able to implicitly convert to float.

Example

SELECT ACOS(0.5) AS AcosValue;

Output

0.523598775598299

Explanation

The ACOS() function returns the arc cosine of a number. In the provided example, the ACOS of 0.5 is calculated. The output value is in radians.

ACOS(numeric_value)

  • numeric_value: This is the numeric value for which the Arc Cosine value is to be calculated. It should lie in the range of -1 to 1 because acos returns NULL if the absolute value of the argument exceeds 1.

Example

SELECT ACOS(0.5) FROM dual;

Output

1.047197551

Explanation

In this example, the ACOS function returns the arc cosine of 0.5. The return value is in the range of 0 to π radians. The value 1.047197551 is approximately 60 degrees which is the cosine inverse of 0.5.

ACOS(X)

  • x: This is the numeric value for which the arccosine is to be calculated. The value of X must lie in the range -1 to +1.

Example

SELECT ACOS(0.5);

Output

1.0471975511966

Explanation

The ACOS function in SQLite computes the arc cosine of a given number. In this example, it computes the arc cosine of 0.5. The output, 1.0471975511966, is the computed value in radians.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.