V+ Language Reference Guide, v17.x


$LNGB string function

Syntax

$LNGB (value)

Function

Return a 4-byte string containing the binary representation of a 32-bit integer.

Usage Considerations

Real values are rounded and any fractional part is lost. Values must be in the range ^H7FFFFFFF to -^H80000000

Parameter

value Real value, variable, or expression whose value is to be converted to its binary representation.

Details

The integer part of a real value is converted into its binary representation; the low 32-bits of that binary representation are packed into a string as four 8-bit characters. Bits 25 to 32 are packed into the first byte, followed by bits 17 to 24 in the second byte, and so forth.

The main use of this function is to convert integer values to binary representation within an output record of a data file.

The operation performed by this function is equivalent to the following expression:

$CHR(INT(value/^H1000000) BAND ^HFF)
+ $CHR(INT(value/^H10000) BAND ^HFF)
+ $CHR(INT(value/^H100) BAND ^HFF)
+ $CHR(INT(value) BAND ^HFF) 	 	

Example

Returns the value $INTB(67)+$INTB(12345).

$LNGB(67*65536+12345)

Related Keywords

$CHR string function

$FLTB string function

$INTB string function

LNGB real-valued function

$TRANSB string function


Submit comments to: techpubs@adept.com
Last modified on: 3/27/2012
Copyright © 1994 - 2012. Adept Technology, Inc.