Here, We will learn about Ldexp() fucntion in math package in go.
Function prototype:
func Ldexp(fract float64, expo int) float64
Return value:
Ldexp is the inverse of Frexp.
It returns fract × 2**expo.
Example with code:
package main
import (
"fmt"
"math"
)
func main() {
no := math.Ldexp(2.3, 2)
fmt.Println(no)
no = math.Ldexp(-2.2, -10)
fmt.Println(no)
no = math.Ldexp(1.2, -1)
fmt.Println(no)
no = math.Ldexp(3, 0)
fmt.Println(no)
}
Output:
9.2
-0.0021484375
0.6
3
To learn more about golang, Please refer given below link:
https://www.techieindoor.com/go-lang-tutorial/
References:
https://golang.org/doc/
https://golang.org/pkg/