Home »
Golang »
Golang Reference
Golang math.SqrtE Constant with Examples
Golang | math.SqrtE Constant: Here, we are going to learn about SqrtE constant of the math package with its usages, syntax, and examples.
Submitted by IncludeHelp, on August 24, 2021
math.SqrtE Constant
The SqrtE constant is an inbuilt constant of the math package which is used to get the square root of mathematical constant e, approximately equal to 1.64872127.
Syntax
float64 math.SqrtE
Parameters
Return Value
The return type of math.SqrtE constant is float64, it returns the square root of mathematical constant e.
Example 1
// Golang program to demonstrate the
// example of math.SqrtE Constant
package main
import (
"fmt"
"math"
)
func main() {
fmt.Printf("Type of math.SqrtE is %T\n", math.SqrtE)
fmt.Println("Value of math.SqrtE:", math.SqrtE)
}
Output:
Type of math.SqrtE is float64
Value of math.SqrtE: 1.6487212707001282
Explanation:
In the above program, we imported the math package to use the math.SqrtE constant, then printed the type and value of the math.SqrtE constant.
Example 2
// Golang program to demonstrate the
// example of math.SqrtE Constant
package main
import (
"fmt"
"math"
)
// creating function to return
// the value of SqrtE.
func getSqrtE() float64 {
return math.SqrtE
}
func main() {
fmt.Println("Value of math.SqrtE:", getSqrtE())
}
Output:
Value of math.SqrtE: 1.6487212707001282
Golang math Package Constants and Functions »