Go 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:
xis the value whose arccosine value is to be found.- The range must be between
-1and1. - If the parameter is either less than
-1or greater than1it 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.
Learn Go on Codecademy
- Looking for an introduction to the theory behind programming? Master Python while learning data structures, algorithms, and more!
- Includes 6 Courses
- With Professional Certification
- Beginner Friendly.75 hours
- Learn how to use Go (Golang), an open-source programming language supported by Google!
- Beginner Friendly.6 hours