SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
Host Variables in C/C++ Programs
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
3-7
Using Corresponding SQL and C Data Types
float
specifies the data type of a target host variable for a column of this SQL data type:
REAL
Tandem floating-point REAL data type is stored with 22 bits of precision and 9 bits
of exponent. The precision corresponds to the precision of the column value. IEEE
floating-point format REAL is stored in 4 bytes with 23 bits of binary precision and
8 bits of exponent.
double
specifies the data type of a target host variable for a column of one of these SQL
data types:
FLOAT [(p)]
DOUBLE PRECISION
IEEE floating-point format FLOAT (p) and DOUBLE are stored in 8 bytes with 52
bits of binary precision and 11 bits of exponent. The storage size for the IEEE
floating-point format is implementation-defined. This is ANSI-compliant behavior.
The maximum precision for an IEEE data type is 52. The precision corresponds to
the precision of the column value.
For the corresponding SQL and C host variable data types for FLOAT data types, see
Table 3-2 on page 3-9. For the generated C data types for NUMERIC, PIC, and
DECIMAL, see Table 3-1 on page 3-8.
Using Corresponding SQL and C Data Types
Table 3-1 lists the corresponding SQL data types, C host variable data types, and
translated C declarations for the NUMERIC, DECIMAL, PIC, SMALLINT and
LARGEINT data types.
Table 3-2
on page 3-9 lists the corresponding SQL data types, C host variable data
types, and translated C declarations for the FLOAT data types.
Table 3-3
on page 3-9 lists the corresponding SQL data types, C host variable data
types, and translated C declarations for the date-time data types.
Most SQL data types with scale have extended host variable data types. You can
specify a C/C++ variable as a host variable if it has a corresponding SQL data type.