math.Ldexp() Function in Golang with Examples Last Updated : 28 Apr, 2020 Summarize Comments Improve Suggest changes Share 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. This package provides Ldexp() function which is used to find the inverse of Frexp. Or in other words, this function return frac × 2**exp. So, you need to add a math package in your program with the help of the import keyword to access the Ldexp() function. Syntax: func Ldexp(frac float64, exp int) float64 If Ldexp(±0, exp), then this function will return ±0. If Ldexp(±Inf, exp), then this function will return ±Inf. If Ldexp(NaN, exp), then this function will return NaN. Example 1: C // Golang program to illustrate // math.Ldexp() Function package main import ( "fmt" "math" ) // Main function func main() { // Finding the inverse of Frexp // Using Ldexp() function res_1 := math.Ldexp(1.1, 5) res_2 := math.Ldexp(math.Inf(-1), 2) res_3 := math.Ldexp(+0, 1) res_4 := math.Ldexp(2, 5) res_5 := math.Ldexp(math.NaN(), 1) // Displaying the result fmt.Printf("\nResult 1: %f", res_1) fmt.Printf("\nResult 2: %f", res_2) fmt.Printf("\nResult 3: %f", res_3) fmt.Printf("\nResult 4: %f", res_4) fmt.Printf("\nResult 5: %f", res_5) } Output: Result 1: 35.200000 Result 2: -Inf Result 3: 0.000000 Result 4: 64.000000 Result 5: NaN Example 2: C // Golang program to illustrate // math.Ldexp() Function package main import ( "fmt" "math" ) // Main function func main() { // Finding the inverse of Frexp // Using Ldexp() function nvalue_1 := math.Ldexp(2, 5) nvalue_2 := math.Ldexp(6, 2) // Finding the sum of inverse of Frexp res := nvalue_1 + nvalue_2 fmt.Println("Result 1: ", nvalue_1) fmt.Println("Result 2: ", nvalue_2) fmt.Println("Sum of Result 1 and Result 2: ", res) } Output: Result 1: 64 Result 2: 24 Sum of Result 1 and Result 2: 88 Comment More infoAdvertise with us Next Article math.Inf() Function in Golang With Examples K Kirti_Mangal Follow Improve Article Tags : Go Language Golang-Math Similar Reads math.Lgamma() 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. This package provides Lgamma() function which is used to find the natural logarithm and sign (either -1 or +1) of Gamma(a). So, you need to add 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.Pow() 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 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 i 3 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 math.Expm1 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 are allowed to find base-e exponential of the specified number minus 1, i.e., e**a -1 with the help of Expm1() function provided by the math 2 min read Like