BitConverter GetBytesFromFloat

Returns the specified float value as a Byte Array.

Syntax

GetBytesFromFloat( float value, [bool isLittleEndian] )

 

Parameters

value float Value to be converted.
isLittleEndian bool True for little-endian False for big-endian. [ optional]

 

Return Values

Returns a Byte Array of 4 bytes.

 

Copy
Example
--This program will demonstrate the BitConverter.GetBytesFromFloat method. 

        
--The Float value
value = 3.40282347E+38  
--Convert value to ByteArray "true" on little-endian systems and "false" on big-endian systems
bytes = BitConverter.GetBytesFromFloat(value, true
 
for i= 1, bytes.Length() do
    --ByteArray element convert to Hexa decimal format and display 
    Report(String.ToHexString(bytes[i]))
end