omron — LNGB real-valued function

LNGB real-valued function LNGB real-valued function Syntax LNGB ($string, first_char ) Function Return the value of four bytes of a string interpreted as a signed 32-bit binary integer. Usage Considerations Since single-precision numbers are stored internally with only 24 bits of significance, input values that contain more than 24 significant bits are converted with some loss in precision. Double-precision numbers are stored with 32 bits of significance with the MSB being the sign bit. Doubles are converted with no loss of precision. Parameters $string String constant, variable, or expression that contains the four bytes to be converted.

first_char Optional real value, variable, or expression (interpreted as an integer) that specifies the position of the first of the four bytes in the string. An error results if first_char specifies a series of four bytes that goes beyond the end of the input string. If first_char is omitted or has the value 0 or 1, the first four bytes of the string are extracted. If first_char is greater than 1, it is interpreted as the character position for the first byte (see below). Details Four sequential characters (bytes) of a string are interpreted as being a 2's-complement 32- bit signed binary integer.

The first of the four bytes contains bits 25 to 32 of the integer, the second of the four bytes contains bits 17 to 24, etc. For example, if first_char has the value 9, then the ninth character (byte) in the input string contains bits 25 to 32 of the integer, the tenth byte of the string contains bits 17 to 24, and so forth. The main use of this function is to convert binary numbers from an input data record to values that can be used internally by eV+. eV+Language Reference Guide, v2.x, 18319-000 Rev A Page 326