Atan()
Published Sep 14, 2023Updated May 15, 2024
Contribute to Docs
The Atan()
function returns the arctangent, in radians, of a given value.
Syntax
result := math.Atan(x)
Notes on .Atan()
:
x
is the value whose arctangent value is to be found.- The
result
will be between -π/2 to π/2 radians. - If the argument is
NaN
it returnsNaN
. - The value returned will be of type
float64
.
Example
The following code calculates the arctangent and prints out the result:
package mainimport ("fmt""math")func main() {fmt.Println(math.Atan(33))fmt.Println(math.Atan(math.NaN()))}
The output will be:
1.5405025668761214NaN
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.