SPARC64X and SPARC64X+ support the Decimal Floating-Point data type and operations. The data format conforms to 64bit DPD defined in IEEE 754-2008. The compiler provides the type and various functions to handle the data.
To represent Decimal Floating-Point numbers, _Decimal64 intrinsic type is declared in dpd_conf.h. You must include the header file prior to use of the type as in the following example:
#include <dpd_conf.h> int main(void) { _Decimal64 dd; ... return 0; }
_Decimal64 type
can be modified with type modifiers: const and/or volatile.
can be specified with storage class specifiers: auto, static, register, extern and/or typedef.
can be an element of an aggregate: array, struct and/or union.
_Decimal64 type variables
can be a formal parameter of a function.
can be an actual argument of a function call.
can be the return value of a function.
can be lhs or rhs of assignment operator "=".
can be the operand of address operator "&".
can be the operand of sizeof operator.
can be the operand of typeof operator.
Intrinsic functions are provided for other operations such as arithmetic, comparison, or type conversion.
Literal syntax for _Decimal64 is not supported. Intrinsics for type conversion can be used instead.
Memory alignment of an _Decimal64 type data is the same as a 64-bit Binary Floating-Point number.
The __DEC_FP_INTR macro is defined as 1 when -xarch=[sparcace|sparcaceplus] and -m64 are specified. This macro is useful to determine whether the compiler supports the Decimal Floating-Point intrinsics feature.
The DEC_EVAL_METHOD macro required by IEEE 754-2008 is defined as 1 when dpd_conf.h is included.
The __STDC_DEC_FP__ macro is not defined, as the compiler does not fully support the functionality described in ISO/IEC TR 24732.
The #pragma FLOAT_CONST_DECIMAL_64 required by IEEE 754-2008 is not supported.
Intrinsic functions listed below are declared in dpd_conf.h. They are useful to operate _Decimal64 type variables.
This function stores src into memory addressed by addr. addr must be aligned on an 8-byte boundary, or the behavior is undefined regardless of the -xmemalign setting.
This function loads _Decimal64 type value from memory addressed by addr, and returns it. addr must be aligned on an 8-byte boundary, or the behavior is undefined regardless of the -xmemalign setting.
This function adds src1 and src2, and returns the result. A floating-point exception is thrown in accordance with the IEEE 754-2008 standard.
This function subtracts src2 from src1, and returns the result. A floating-point exception is thrown in accordance with the IEEE 754-2008 standard.
This function multiplies src1 and src2, and returns the result. A floating-point exception is thrown in accordance with the IEEE 754-2008 standard.
This function divides src1 by src2, and returns the result. A floating-point exception is thrown in accordance with the IEEE 754-2008 standard.
This function computes the absolute value of src and returns the result. No floating-point exception is thrown even if src is signaling NaN.
This function reverses the sign of src and returns the result. No floating-point exception is thrown even if src is signaling NaN.
This function returns non-0 when src1 is equal to src2, otherwise it returns 0. The treatments of NaN, Inf and negative-Zero conforms to IEEE 754-2008.
This function returns non-0 when src1 is not equal to src2, otherwise it returns 0. The treatments of NaN, Inf and negative-Zero conforms to IEEE 754-2008.
This function returns non-0 when src1 is grater than src2, otherwise it returns 0. The treatments of NaN, Inf and negative-Zero conforms to IEEE 754-2008.
This function returns non-0 when src1 is grater than or equal to src2, otherwise it returns 0. The treatments of NaN, Inf and negative-Zero conforms to IEEE 754-2008.
This function returns non-0 when src1 is less than src2, otherwise it returns 0. The treatments of NaN, Inf and negative-Zero conforms to IEEE 754-2008.
This function returns non-0 when src1 is less than or equal to src2, otherwise it returns 0. The treatments of NaN, Inf and negative-Zero conforms to IEEE 754-2008.
This function converts a 64-bit signed integer value in src to a Decimal Floating-Point value and returns the result.
This function converts a 64-bit unsigned integer value in src to a Decimal Floating-Point value and returns the result.
This function converts a Binary Floating-Point value in src to a Decimal Floating-Point value and returns the result.
This function converts a Decimal Floating-Point value in src to a 64-bit signed integer value and returns the result.
This function converts a Decimal Floating-Point value in src to a 64-bit unsigned integer value and returns the result.
This function converts a Decimal Floating-Point value in src to a Binary Floating-Point value and returns the result.
This function retrieves the current rounding mode for _Decimal64. The value is defined in dpd_conf.h, as follows:
round to nearest, ties to even
round toward zero
round toward positive infinity
round toward negative infinity
round to nearest, ties away from zero
The initial value of the rounding mode for _Decimal64 is __DPD_ROUND_NEAREST. Note that the -fround option does not alter the rounding mode for _Decimal64.
This function set the rounding mode for _Decimal64 to r. r should be one those listed above. It returns 0 on success or non-0 on failure.