Learn and Learn

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

GoLang – Find Binary Representation – Float32frombits() Function – Examples & Explanation

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

Syntax of Float32frombits() Function in Go Programming

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

Note: float32is the set of all IEEE-754 32-bit floating-point numbers and uint32 is the set of all unsigned 32-bit integers. With the range of 0 through 4294967295.

 

Parameters of Float32frombits() Function in Go Programming

x – Where x is any Valid float32 Input value. This parameter is required.

 

Error Handling

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

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

 

GoLang Float32frombits() Function Example 1


Output:
4e-45

 

GoLang Float32frombits() Function Example 2


Output:
1.25e-43

 

GoLang Float32frombits() Function Example 3


Output:
NaN

 

LearnAndLearn.com © 2018 - All rights reserved