SQL/MX 3.2 Programming Manual for C and COBOL (H06.25+, J06.14+)
Host Variables in C/C++ Programs
HP NonStop SQL/MX Release 3.2 Programming Manual for C and COBOL—663854-002
3-7
Using Corresponding SQL and C Data Types
precision. ANSI IEEE floating-point data type FLOAT(p) declarations are stored in 8
bytes regardless of the precision.
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.
Note. The floating-point format for SQL/MP tables is Tandem. The floating-point format for
SQL/MX format tables is IEEE. Use the -o preprocessor option to change the format of data
that is input or output to host variables in an embedded program. See Running the
SQL/MX C/C++ Preprocessor on page 15-8.










