Skip to main content
  1. Tutorials/

🍩 Get Pi constant in Go

·1 min

To get the value of the Pi (π) constant in Go, use the mathematical constant math.Pi from the standard library math package.

package main

import (
    "fmt"
    "math"
)

func main() {
    fmt.Printf("%.48f", math.Pi)
}

Output:

3.141592653589793115997963468544185161590576171875