Float64bits()
function is used to find the IEEE 754 binary representation of x
for the given input (x
– parameter) in Go language. The standard math package of Go programming language has Float64bits()
function.
Syntax of Float64bits()
Function in Go Programming
The syntax of
Note:
Float64bits()
function in Go Language is:1 | func Float64bits(x float64) uint64 |
Note:
float64
is a data type in Go language which has IEEE-754 64-bit floating-point numbers. uint64
is the set of all unsigned 64-bit integers.
Parameters of Float64bits()
Function in Go Programming
x
– Where x
is any Valid float64
Input value. This parameter is required.
Error Handling
If the
If there is no argument (
x
parameter is not a number (numeric value) Float64bits()
function returns an error
.If there is no argument (
x
– input value) passes to the function, then the compiler will produce an error
.
Return Value of Float64bits()
Function in Go Programming
Float64bits()
function will return the IEEE 754 binary representation of the given input(x
– parameter).
GoLang Float64bits()
Function Example 1
1 2 3 4 5 6 7 8 9 10 | package main import "fmt" import "math" func main() { var x uint64 x = math.Float64bits(2) fmt.Println(x) } |
Output:
4611686018427387904
GoLang Float64bits()
Function Example 2
1 2 3 4 5 6 7 8 9 10 | package main import "fmt" import "math" func main() { var x uint64 x = math.Float64bits(-17.6) fmt.Println(x) } |
Output:
13849019214127012250
GoLang Float64bits()
Function Example 3
1 2 3 4 5 6 7 8 9 10 | package main import "fmt" import "math" func main() { var x uint64 x = math.Float64bits(4294967295) fmt.Println(x) } |
Output:
4751297606873776128
Loading...