Convert Float32 to Float64 and Float64 to Float32
Example
package main
import (
"fmt"
"reflect"
)
func main() {
var f32 float32 = 10.6556
fmt.Println(reflect.TypeOf(f32))
f64 := float64(f32)
fmt.Println(reflect.TypeOf(f64))
f64 = 1097.655698798798
fmt.Println(f64)
f32 = float32(f64)
fmt.Println(f32)
}
Output
float32
float64
1097.655698798798
1097.6556
Most Helpful This Week
Golang program for implementation of ZigZag Matrix
Golang program for implementation of Floyd–Warshall Algorithm
Go program to find SRV service record of a domain
Golang program for implementation of Longest Common Sub-sequence
Golang program for drawing a Cuboid
How do you send an HTTP DELETE request in Go?
Create and Print Multi Dimensional Slice in Golang
Expected <type>, but got <type> error in Golang
Top Programming Languages Behind Blockchain App Development
Example: How to use TeeReader from IO Package in Golang?