GoLang – Find Inverse of Tan – Atan() Function – Examples & Explanation

Atan() function is used to find the inverse of a tan in Go language. The inverse of a tan is also known as arctan. Atan() function is a part of math library of Go programming language.

Syntax of Atan() in Go Language

The syntax of Atan() function is:

func Atan(x float64) float64

Note: float64 is a data type in go language which has IEEE-754 64-bit floating-point numbers.
Special cases are:
Atan(±0) = ±0
Atan(±Inf) = ±Pi/2

 

Parameters of Atan() Function in Go Language

x Any Valid GoLang number ( positive or negative ). This parameter is required.
Note: if the x parameter is not a number, Atan() function will return an error.

 

Atan() Return Value

Atan() function returns a floating point number ( a value of the inverse of tan in radians ).

 

GoLang Atan() Function Example 1:

package main

import "fmt"
import "math"

func main() {
	var x float64
	x = math.Atan(-1)
	fmt.Println(x)
}

Output
-0.7853981633974483

 

GoLang Atan() Function Example 2:

package main

import "fmt"
import "math"

func main() {
	var x float64
	x = math.Atan(0)
	fmt.Println(x)
}

Output:
0

 

GoLang Atan() Function Example 3:

package main
import "fmt"
import "math"
func main() {
	var x float64
	x = math.Atan(2)
	fmt.Println(x)
}

Output:
1.1071487177940904