Menu Close

Go – How to get the arctangent in radians of number

Here, We will learn how to get the arctangent in radians of number in go. We can get it by using Atan() function in math package in go golang.

Function prototype:

func Atan(no float64) float64

Return value:

Atan() function in math package returns
the arctangent in radians of number

Example with code:

package main

import (
  "fmt"
  "math"
)

func main() {

  no := math.Atan(0)
  fmt.Printf("%.2f\n", no)

  no = math.Atan(1)
  fmt.Printf("%.2f\n", no)

  no = math.Atan(2)
  fmt.Printf("%.2f\n", no)

  no = math.Atan(0.75)
  fmt.Printf("%.2f\n", no)

}

Output:

0.00
0.79
1.11
0.64

To learn more about golang, Please refer given below link:

https://techieindoor.com/go-lang-tutorial/

References:

https://golang.org/doc/
https://golang.org/pkg/
Posted in golang, math

Leave a Reply

Your email address will not be published. Required fields are marked *