%B4ToReal32 function


Function
Function performs the conversion of a binary representation of a 32 bit value of Real type to a value of Real type.
Declaration
REAL %B4ToReal32(
   INT in _b4,
   INT in _b3,
   INT in _b2,
   INT in _b1,
 )
Parameters
_b4binary representation of value. Bits 24 .. 31 (the most significant byte)
_b3binary representation of value. Bits 16 .. 23
_b2binary representation of value. Bits 8 .. 15
_b1binary representation of value. Bits 0 .. 7 (tne least significant byte)
Description
The conversion function implements the conversion from the binary representation of the 32 bit real number according to the IEEE 754 standard do to the REAL type value. The binary representation is expressed by _b1 to _b4 values. Values must range from 0 to 255. If the entry does not correspond to the real number according to IEEE 754 standard, the function returns an invalid value.
Example
 REAL _r
 ; valid Float 519.3165
 _r := %B4ToReal32(%StrToI("16#44#"), %StrToI("16#01#"), %StrToI("16#D4#"), %StrToI("16#42#"))

 ; invalid Float
 _r := %B4ToReal32(%StrToI("16#7F#"), %StrToI("16#C0#"), %StrToI("16#00#"), %StrToI("16#00#")) 
Napíšte komentár