C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Compiling and Linking TNS/R Native C and C++
Programs
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
16-5
Using Compiler Pragmas IEEE_Float and
Tandem_Float
Using Compiler Pragmas IEEE_Float and Tandem_Float
To use IEEE floating-point format, you must specify the IEEE_FLOAT pragma on
the command line when running the native C or C++ compiler. If you are using
native C++, you also need to specify the VERSION2 or VERSION3 directive. For
more details, see the pragmas IEEE_FLOAT on page 13-44, VERSION2 on
page 13-108, and VERSION3 on page 13-110.
To use Tandem floating-point format, you can optionally specify the
TANDEM_FLOAT pragma (TANDEM_FLOAT is the default setting) on the
command line when running the native C or C++ compiler. See the pragma
TANDEM_FLOAT on page 13-105.
The native compilers set the floating-point format type in the generated object file.
Two examples of compiling native C and C++ programs that use IEEE floating-point
format:
NMC / IN SOURCEA, OUT $.#LIST / OBJECTA; IEEE_FLOAT
> NMCPLUS / IN SOURCEB, OUT $S.#LIST / OBJECTB; VERSION2, &
IEEE_FLOAT
Using Link Options to Specify Floating-Point Format
When linking object files using the TNS/R native linker utility, you can specify the
floating-point state of the output object file using the -set floattype flag. You can
set any of these three options: TANDEM_FLOAT, IEEE_FLOAT, or NEUTRAL_FLOAT. If
the -set floattype flag is not specified, the TNS/R native linker utility derives the
floating-point state of the output object file from the states of the input files.
Remains default format on TNS and TNS/R
systems, and is available for TNS C and
C++, FORTRAN, TAL, pTAL, Pascal,
COBOL, and native C and C++ programs
For TNS/R native C and C++ programs, IEEE
floating-point format becomes effective only
by specifying IEEE_FLOAT in the command
directive
Requires conversion routines for data
interchange between Tandem format and
IEEE format (see the Guardian Procedure
Calls Reference Manual for more detail
about conversion routines)
Provides easier data interchange with other
systems using 64-bit and 32-bit IEEE floating-
point data formats; interchange typically
consists of reversing the byte order to convert
between big-endian data format (on NonStop
systems) and little-endian format (on the
target system)
Provides better handling of exception
conditions such as overflow and underflow;
the existence of NaN (not a number),
infinities, and exception flags make it easier to
detect invalid results
Tandem Floating-Point Format IEEE Floating-Point Format (continued)