User`s guide
Cray XMT™ Programming Environment User’s Guide
3.4.3 32-bit and 64-bit Implementation of Floating-point Arithmetic
The double data type in C uses the format for double-precision (64-bit) arithmetic
provided by IEEE Standard 754 guidelines. Cray XMT hardware does not support
IEEE Standard 754 extended precision, and all 32-bit arithmetic is done by promotion
to 64-bit formats.
Rounding mode on the Cray XMT is controlled on a per-thread basis using mode
bits in the stream status word (SSW). A newly created stream inherits the rounding
mode of its parent.
Hardware instructions that convert from an int or unsigned int number to a
floating-point number use the same rounding mode as the SSW. You can use the
MTA_FLOAT_UNS intrinsic function when converting large unsigned integers to
a floating-point number. You can use the current rounding mode as the basis for
converting a floating-point number to an integer by using the MTA_FLOAT_ROUND
intrinsic function or use explicit rounding that ignores the mode bits in the SSW by
using the MTA_FLOAT_CEIL, MTA_FLOAT_CHOP, MTA_FLOAT_FLOOR,or
MTA_FLOAT_NEAR intrinsic functions.
Each thread has its own set of floating-point exception flags and traps that can be
enabled in its SSW. The normal mode of operation is to run with all floating-point
traps disabled.
If you convert a 64-bit floating-point number to a decimal string with at least 17
significant decimal digits and then convert it back to 64-bit floating-point number,
the result matches the original. If you convert a decimal string with n less than 15
decimal digits to 64-bit floating-point number and then convert it back to n decimal
digits, the result matches the original string.
Add, subtract, and multiply operations each use one processor instruction on the
Cray XMT. Divide operations use eight instructions, and square root operations
require ten instructions. There is room in the divide and square-root sequences for
other operations, particularly in the memory unit.
3.4.4 Rounding Results of Floating-point Operations
The standard C math and C++ cmath libraries implement a set of functions that you
can use when performing basic mathematical operations such as the log function
for logarithms. When you use the math library functions on the Cray XMT, these
mathematical operations do not necessarily produce correctly rounded results, except
for the sqrt() function. Function results are generally accurate to within one unit in
the last place, but there are exceptions, especially for large arguments. Trigonometric
functions do infinitely precise argument reduction.
Numbers are rounded according to the IEEE Standard 754. The default rounding
method is overridden when you use the following intrinsic conversion functions:
MTA_FLOAT_CEIL, MTA_INT_CHOP, and MTA_UNS_FLOOR.
30 S–2479–20