math.Pow() Function in Golang With Examples Last Updated : 13 Apr, 2020 Comments Improve Suggest changes Like Article Like Report Go language provides inbuilt support for basic constants and mathematical functions to perform operations on the numbers with the help of the math package. You can find the base-a exponential of b(a**b)with the help of Pow() function provided by the math package. So, you need to add a math package in your program with the help of the import keyword to access Pow() function. Syntax: func Pow(a, b float64) float64 If Pow(a, ±0), then this method will return 1 for any a. If Pow(1, b), then this method will return 1 for any b. If Pow(a, 1), then this method will return a for any a. If Pow(NaN, b), then this method will return NaN. If Pow(a, NaN), then this method will return NaN. If Pow(±0, b), then this method will return ± Inf for b an odd integer < 0. If Pow(±0, -Inf), then this method will return +Inf. If Pow(±0, +Inf), then this method will return +0. If Pow(±0, b), then this method will return +Inf for finite b < 0 and not an odd integer. If Pow(±0, b), then this method will return ± 0 for b an odd integer > 0. If Pow(±0, b), then this method will return +0 for finite b > 0 and not an odd integer. If Pow(+1, ±Inf), then this method will return 1. If Pow(a, +Inf), then this method will return +Inf for |a| > 1. If Pow(a, -Inf), then this method will return +0 for |a| > 1. If Pow(a, +Inf), then this method will return +0 for |a| < 1. If Pow(a, -Inf), then this method will return +Inf for |a| < 1. If Pow(+Inf, b), then this method will return +Inf for b > 0. If Pow(+Inf, b), then this method will return +0 for b < 0. If Pow(-Inf, b), then this method will return Pow(-0, -b). If Pow(a, b), then this method will return NaN for finite a < 0 and finite non-integer b. Example 1: C // Golang program to illustrate // the use of math.Pow() function package main import ( "fmt" "math" ) // Main function func main() { // Finding the base-a exponential of b // Using Pow() function res_1 := math.Pow(3, 5) res_2 := math.Pow(math.Inf(1), 3) res_3 := math.Pow(2, 0) res_4 := math.Pow(1, math.NaN()) res_5 := math.Pow(-0, math.Inf(-1)) // Displaying the result fmt.Printf("Result 1: %.1f", res_1) fmt.Printf("\nResult 2: %.1f", res_2) fmt.Printf("\nResult 3: %.1f", res_3) fmt.Printf("\nResult 4: %.1f", res_4) fmt.Printf("\nResult 5: %.1f", res_5) } Output: Result 1: 243.0 Result 2: +Inf Result 3: 1.0 Result 4: 1.0 Result 5: +Inf Example 2: C // Golang program to illustrate // the use of math.Pow() function package main import ( "fmt" "math" ) // Main function func main() { // Finding the base-a exponential of b // Using Pow() function nvalue_1 := math.Pow(3, 4) nvalue_2 := math.Pow(5, 6) // Sum of the given numbers res := nvalue_1 + nvalue_2 fmt.Printf("%.3f + %.3f = %.3f", nvalue_1, nvalue_2, res) } Output: 81.000 + 15625.000 = 15706.000 Comment More infoAdvertise with us Next Article math.Pow() Function in Golang With Examples K Kirti_Mangal Follow Improve Article Tags : Go Language Golang-Math Similar Reads math.Round() Function in Golang With Examples Go language provides inbuilt support for basic constants and mathematical functions to perform operations on the numbers with the help of the math package. You can round off the given number to the nearest integer(rounding half away from zero) with the help of Round() function provided by the math p 2 min read math.NaN() Function in Golang With Examples Go language provides inbuilt support for basic constants and mathematical functions to perform operations on the numbers with the help of the math package. You get an IEEE 754 "not-a-number" value with the help of NaN() function provided by the math package. So, you need to add a math package in you 1 min read math.Yn() Function in Golang With Examples Go language provides inbuilt support for basic constants and mathematical functions to perform operations on the numbers with the help of the math package. You can the order-n Bessel function of the second kind the help of Yn() function provided by the math package. So, you need to add a math packag 2 min read math.Jn() Function in Golang With Examples Go language provides inbuilt support for basic constants and mathematical functions to perform operations on the numbers with the help of the math package. You can find the order-n Bessel function of the first kind with the help of Jn() function provided by the math package. So, you need to add a ma 2 min read math.Y0() Function in Golang With Examples Go language provides inbuilt support for basic constants and mathematical functions to perform operations on the numbers with the help of the math package. You can find the order-zero Bessel function of the second kind with the help of Y0() function provided by the math package. So, you need to add 2 min read math.J0() Function in Golang With Examples Go language provides inbuilt support for basic constants and mathematical functions to perform operations on the numbers with the help of the math package. You can find the order-zero Bessel function of the first kind with the help of J0() function provided by the math package. So, you need to add a 2 min read math.J1() Function in Golang With Examples Go language provides inbuilt support for basic constants and mathematical functions to perform operations on the numbers with the help of the math package. You can find order-one Bessel function of the first kind with the help of J1() function provided by the math package. So, you need to add a math 2 min read math.Inf() Function in Golang With Examples Go language provides inbuilt support for basic constants and mathematical functions to perform operations on the numbers with the help of the math package. You can find positive infinity (if sign >= 0) or negative infinity (if sign < 0) with the help of the Inf() function provided by the math 2 min read math.Dim() Function in Golang With Examples Go language provides inbuilt support for basic constants and mathematical functions to perform operations on the numbers with the help of the math package. Dim() function provided by the math package return the maximum of a-b or 0. So, to access this function you need to add a math package in your p 2 min read math.Ilogb() Function in Golang With Examples Go language provides inbuilt support for basic constants and mathematical functions to perform operations on the numbers with the help of the math package. You can find the binary exponent of the specified number as an integer with the help of ILogb() function provided by the math package. So, you n 2 min read Like