Learn and Learn

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

GoLang – Float32bits() Function – Examples & Explanation

Float32bits() function is used to IEEE 754 binary representation of x for the given input (x – parameter) in Go language.
The standard math package of Go programming language has Float32bits() function. The purpose of this function is to find IEEE 754 binary representation of x within the range of 0 to 4294967295.

Syntax of Float32bits() Function in Go Language

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

Note: uint32 is the set of all unsigned 32-bit integers. Which range starts from 0 to 4294967295. and float32 is the set of all IEEE-754 32-bit floating-point numbers.

 

Parameters of Float32bits() Function in Go Language

x – Where x is any Valid uint32 Input value (Within the range of 0 to 4294967295). This parameter is required.

 

Error Handling

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

Float32bits() function will return the IEEE 754 binary representation of x of the given input(x – parameter).

 

GoLang Float32bits() Function Example 1


Output:
1099431936

 

GoLang Float32bits() Function Example 2


Output:
1065353216

 

GoLang Float32bits() Function Example 3


Output:
1091567616

 

Loading...
LearnAndLearn.com © 2018 - All rights reserved