Standard library / math

math.Atan2()

Angle in radians for vector (x,y), using both signs to identify quadrant. Expected stdout: '1.570796\n'.

Formal Syntax & Structure

go syntaxgo
func Atan2(y, x float64) float64

Parameters & Attributes

NameTypeDescription
yfloat64Second input operand.
xfloat64First input operand (or sole input if unary).

Return Value

float64

Angle in radians for vector (x,y), using both signs to identify quadrant.

Working Example

Example Snippetgo
package main
import (  "fmt"  "math")
func main() {  fmt.Printf("%.6f\n", math.Atan2(1, 0))}
Go Reference