Cookies management by TermsFeed Cookie Consent
Russia has invaded Ukraine and already killed tens of thousands of civilians, with many more raped or tortured. It's a genocide. We need your help. Let's fight back against the Russian regime.
Help Ukraine! Fight the Russian regime!

🍩 Get Pi constant in Go

shorts numbers math

Please consider supporting us by disabling your ad blocker

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

🧊 Cube root in Go

shorts numbers math

🟦 Square root in Go

shorts numbers math

🍰 The maximum and minimum value of the int types in Go

shorts numbers math