# Golang math.Pi Constant with Examples

Golang | math.Pi Constant: Here, we are going to learn about Pi constant of the math package with its usages, syntax, and examples.
Submitted by IncludeHelp, on August 24, 2021

## math.Pi Constant

The Pi constant is an inbuilt constant of the math package which is used to get the value of the mathematical constant π. The number π is a mathematical constant, approximately equal to 3.14159. It is defined in Euclidean geometry as the ratio of a circle's circumference to its diameter, and also has various equivalent definitions.

Syntax:

```float64 math.Pi
```

Parameter(s):

• None

Return Value:

The return type of math.Pi constant is float64, it returns the value of mathematical constant π.

Example 1:

```// Golang program to demonstrate the
// example of math.Pi Constant

package main

import (
"fmt"
"math"
)

func main() {
fmt.Printf("Type of math.Pi is %T\n", math.Pi)
fmt.Println("Value of math.Pi:", math.Pi)
}
```

Output:

```Type of math.Pi is float64
Value of math.Pi: 3.141592653589793
```

Explanation:

In the above program, we imported the math package to use the math.Pi constant, then printed the type and value of the math.Pi constant.

Example 2:

```// Golang program to demonstrate the
// example of math.Pi Constant

package main

import (
"fmt"
"math"
)

// creating function to return
// the value of Pi.
func getPi() float64 {
return math.Pi
}

func main() {
fmt.Println("Value of math.Pi:", getPi())
}
```

Output:

```Value of math.Pi: 3.141592653589793
```