Atan()

arisdelaCruz1413618857's avatar
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 returns NaN.
  • The value returned will be of type float64.

Example

The following code calculates the arctangent and prints out the result:

package main
import (
"fmt"
"math"
)
func main() {
fmt.Println(math.Atan(33))
fmt.Println(math.Atan(math.NaN()))
}

The output will be:

1.5405025668761214
NaN

All contributors

Contribute to Docs

Learn Go on Codecademy