To take the arccosine (inverse cosine) of a number in Go, you can use the math package's Acos
function.
Here's an example code snippet:
main.go337 chars17 lines
The output of this code would be:
main.go55 chars2 lines
Note that the argument to Acos
must be between -1 and 1, or else it will return NaN (not-a-number).
gistlibby LogSnag