V+ Language Reference Guide, v17.x


DBLB real-valued function

Syntax

DBLB ($string, first_char)

Function

Return the value of eight bytes of a string interpreted as an IEEE double-precision floating-point number.

Parameters

$string

String expression that contains the eight bytes to be converted.

first_char

Optional real-valued expression that specifies the position of the first of the eight bytes in the string.

If first_char is omitted or has a value of 0 or 1, the first eight bytes of the string are extracted.

If first_char is greater than 1, it is interpreted as the character position for the first byte. For example, a value of 2 means that the second through ninth bytes are extracted.

If first_char specifies eight bytes that are beyond the end of the input string, an error is generated .

Details

Eight sequential bytes of the given string are interpreted as being a double-precision (64-bit) floating-point number in the IEEE standard format. This 64-bit field is interpreted as follows:

where

s is the sign bit, s = 0 for positive, s = 1 for negative.

exp is the binary exponent, biased by -1023.

fraction is a binary fraction with an implied 1 to the left of the binary point.

For 0 < exp < 2047, the value of a floating point number is:

-1s * (1.fraction) * 2exp-1023

Double-precision real values have the following special values:

exp fraction Description
0 Zero Zero value
0 Nonzero Denormalized number
2047 Zero Signed infinity
2047 Nonzero Not-a-number

The range for normalized numbers is approximately 2.2 x 10-308 to 1.8 x 10307

The main use of this function is to convert a binary floating-point number from an input data record to a value that can be used internally by V+.

Example

DBLB($CHR(^H3F)+$CHR(^HF0)+$CHR(0)+$CHR(0)
+$CHR(0)+$CHR(0)+$CHR(0)+$CHR(0))            ;Returns 1.0

Related Keywords

ASC real-valued function

$DBLB string function

DOUBLE (type keyword for AUTO, GLOBAL, and LOCAL)

FLTB real-valued function

$FLTB string function

INTB real-valued function

TRANSB transformation function

VAL real-valued function


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