Learn and Learn

Learn And Learn - great place for tutorials, references and how-to

GoLang – Find Floating Point Number – Float64frombits() Function – Examples & Explanation

Float64frombits() function is used to find the floating point number corresponding the IEEE 754 binary representation of the given input (x – parameter) in Go language. The standard math package of Go programming language has Float64frombits() function.

Syntax of Float64frombits() Function in Go Programming

The syntax of Float64frombits() function in Go Language is:

Note: uint64 is the set of all unsigned 64-bit integers. Within the range of 0 to 18446744073709551615 and float64 is a data type in Go language which has IEEE-754 64-bit floating-point numbers.

 

Parameters of Float64frombits() Function in Go Programming

x – Where x is any Valid uint64 Input value (Range are 0 to 18446744073709551615). This parameter is required.

 

Error Handling

If the x parameter is not a number (numeric value) Float64frombits() 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 Float64frombits() Function in Go Programming

Float64frombits() function will return the floating point number corresponding the IEEE 754 binary representation of the given input(x – parameter).

 

GoLang Float64frombits() Function Example 1


Output:
0

 

GoLang Float64frombits() Function Example 2


Output:
2.5e-323

 

GoLang Float64frombits() Function Example 3


Output:
2.1219957905e-314

 

LearnAndLearn.com © 2018 - All rights reserved