SQL/MX 3.2.1 Programming Manual for C and COBOL (H06.26+, J06.15+)

Host Variables in C/C++ Programs
HP NonStop SQL/MX Release 3.2.1 Programming Manual for C and COBOL663854-005
3-34
Date-Time and Interval Data
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
representation. Despite this conversion, the precision of Tandem floating-point data
types are maintained correctly in IEEE floating-point format. A Tandem REAL or
FLOAT with precision between 1 and 22 cannot be converted to IEEE REAL because
the Tandem exponent will not fit in an IEEE REAL data type. Although no equivalent
exists for single-precision Tandem REAL and FLOAT in IEEE floating-point format, the
conversion to IEEE DOUBLE preserves the precision and the exponent.
If you want a small floating-point data type with a smaller exponent and less storage,
consider declaring the host variables as float. If you want more exponent and a
larger precision, consider declaring the host variables as double or float(p).
For more information on floating-point formats, see the SQL/MX Reference Manual.
Date-Time and Interval Data
Use the following for date-time and interval data types:
For SQL/MP DATETIME data types that are not equivalent to DATE, TIME, or
TIMESTAMP, you are still required to declare a character array host variable and use
the CAST function for input to and output from date-time or interval columns, similar to
SQL/MX Release 1.8, which does not support ANSI-99 date-time host variables.
DATE Represents a date.
TIME Represents a time.
TIMESTAMP Represents a timestamp.
INTERVAL Represents a duration of time as a year-month or day-time
interval.