ACOS
The angle, in radians, whose cosine is a number.
Group: Math. Compatible with DAX.
Syntax
ACOS ( <number> )
| Parameter | Type | Description |
|---|---|---|
number | Number | A value from -1 to 1, read as a cosine. |
Returns
Number. The angle in radians, from 0 to pi.
Remarks
- A number below -1 or above 1 is the cosine of no angle, and an error.
- A blank counts as 0, so the result is pi / 2.
- For the angle in degrees, wrap it in
DEGREES. - Distances on the globe use it: the great-circle formula below gives the distance between two points from their latitudes and longitudes.
Examples
Angles from cosines
EVALUATE
ROW (
"Of 0.5", ACOS ( 0.5 ),
"In degrees", DEGREES ( ACOS ( 0.5 ) ),
"Of -1", ACOS ( -1 ),
"Of blank", ACOS ( BLANK () )
)
| Of 0.5 | In degrees | Of -1 | Of blank |
|---|---|---|---|
| 1.0471975511966 | 60 | 3.14159265358979 | 1.5707963267949 |
Kilometers between Oslo and Bergen
Latitudes 59.91 and 60.39, longitudes 10.75 and 5.32, on a sphere of radius 6,371 km.
EVALUATE
VAR Lat1 = RADIANS ( 59.91 )
VAR Lat2 = RADIANS ( 60.39 )
VAR DLon = RADIANS ( 5.32 - 10.75 )
RETURN
ROW (
"km",
6371
* ACOS ( SIN ( Lat1 ) * SIN ( Lat2 ) + COS ( Lat1 ) * COS ( Lat2 ) * COS ( DLon ) )
)
| km |
|---|
| 305.135011713485 |