C/C++ Programmer's Guide (G06.25+)
Compiling and Linking TNS/R Native C and C++
Programs
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
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 information, see the pragmas IEEE_FLOAT on page 13-45, VERSION2 on
page 13-106, and VERSION3 on page 13-108.
•
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-102.
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 nld or ld utility, you can specify the floating-point
state of the output object file using the -set floattype flag. You can set any of the
following three options: TANDEM_FLOAT, IEEE_FLOAT, or NEUTRAL_FLOAT. If the
-set floattype flag is not specified, the nld or ld utility derives the floating-point
state of the output object file from the states of the input files.
Remains the default format on HP NonStop
systems, and is available for TNS C and
C++, FORTRAN, TAL, pTAL, Pascal,
COBOL, and native C and C++ programs
Is available only for TNS/R native C and C++
programs and only by specifying IEEE
floating-point using the IEEE_FLOAT
command-line directive
Requires conversion routines for data
interchange between Tandem format and
IEEE format (see the Guardian Procedure
Calls Reference Manual for more
information 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)