Acos()
Published Sep 1, 2023
Contribute to Docs
The Acos()
function returns the arccosine, also known as the inverse cosine, value of the argument (in radians).
Syntax
result := math.Acos(x)
Notes on the parameter:
x
is the value whose arccosine value is to be found.- The range must be between
-1
and1
. - If the parameter is either less than
-1
or greater than1
it returnsNaN
. - The value returned will be of type
float64
.
Example
The following code calculates the arccosine and prints out the result:
package mainimport ("fmt""math")func main() {fmt.Println(math.Acos(-1))fmt.Println(math.Acos(1.23))}
The output will be:
3.141592653589793NaN
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.