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-22
Numeric Data
If you use NonStop SQL/MX to perform computations on a floating-point column in an
SQL/MP table, the result is in IEEE format.
For dynamic queries in embedded SQL programs, the default is Tandem floating-point
format.
For static queries in embedded SQL programs, the input and output depend on the
type of host variables that are declared. This table summarizes the use of IEEE and
Tandem floating points for host variables:
Restrictions for Floating-Point Format
•
You cannot declare both IEEE and Tandem floating-point host variables in an
application program.
•
You cannot use the IEEE floating-point format on hardware that does not support
the format.
•
The conversion between Tandem floating point and IEEE floating point in an
application is not transparent.
Changing the Format of Floating-Point Data Types
To change the format of floating-point data types (FLOAT, REAL, or DOUBLE
PRECISION data types) for dynamic SELECT statements and dynamic parameters,
use the CONTROL QUERY DEFAULT setting, FLOATTYPE, which is Tandem floating
point by default. For information on CONTROL QUERY DEFAULT settings, see the
SQL/MX Reference Manual.
The SQL/MX -o preprocessor option directs the preprocessor to generate IEEE
floating-point types instead of Tandem floating-point types for host variables. For
information on preprocessor settings, see Running the SQL/MX C/C++ Preprocessor
on page 15-8.
Conversion Between Tandem and IEEE Floating-Point
Formats
When converting a Tandem floating-point data type to the corresponding IEEE data
type, all Tandem floating-point data types are converted to IEEE DOUBLE
Embedded SQL/C
Host Variable
Is the -o option
used during
compilation?
Translated C/C++
Declaration for Host
Variables
Generated Definition
in Module Definition
File
float No
*
float (Tandem) REAL
double No
*
double (Tandem) DOUBLE PRECISION
float Yes
**
float (IEEE) REAL_IEEE
double Yes
**
double (IEEE) DOUBLE_IEEE
*
Default for TNS/R-targeted compilations
**
Default for TNS/E-targeted compilations