Decimal floating-point built-in functions
Decimal floating-point built-in functions are provided for each DFP hardware instruction. XL C/C++ developers can use the decimal floating-point built-in functions and macros, or named constants, by calling the functions with appropriate parameters. It is not necessary to include a header file before using decimal floating-point built-in functions. They will be automatically defined by the compiler when DFP is enabled.
All decimal floating-point built-in functions require a hardware level of at least ARCH(7).
Single precision support is limited, as noted in Table 1.
PROTOTYPE and Notes | Description |
---|---|
|
These functions return the absolute value of the parameter. |
|
These functions return the absolute value of the first parameter, with the sign of the second parameter. |
|
These functions create quiet or signaling NaNs of the specified precision, with positive signs and zero payloads. |
The
functions The
functions All these functions set the instruction M4 bit 20 to 0. If the input is a signaling NaN it is converted to a quiet NaN. |
These functions round a decimal floating point value to an integer value in decimal floating point format; any digits after the decimal point are discarded. The current rounding mode is used. |
The round_mode parameter must be a compile-time constant
expression. Use either of the following:
|
These functions return the arithmetic value of the first parameter, with the exponent adjusted to match the second parameter. They can temporarily override the current rounding mode and use the specified rounding mode. |
|
These functions compare the exponents of two parameters. If the exponents are the same, the functions return "true". |
These functions normally return <0, ==0 or >0 to indicate the relation. If either value is a NaN, they return "-2" (unordered). |
These functions compare two decimal floating-point values. Unlike a comparison using standard equality or relational operators, they also raise an Invalid Operation exception when either operand is either a quiet Nan or a signaling NaN. |
The
functions The functions The round_mode parameter must be a compile-time constant
expression. Use either of the following:
|
These functions convert a decimal floating point value to a 64-bit signed binary integer with rounding mode options. |
|
This function gets the current decimal rounding mode from the z/Architecture® FPC register. |
If the rounding mode is
changed within a function, it must be restored before the function
returns.
|
This function sets the specified decimal rounding mode in the z/Architecture FPC register, making it the current mode. |
PROTOTYPE and Notes | Description |
---|---|
|
These functions return "true" if the parameter is not positive or negative infinity, and is not a NaN. |
|
These functions return "true" if the parameter is positive or negative infinity. |
|
These functions return "true" if the parameter is in the normal range, not a subnormal, infinity or NaN. |
|
These functions return "true" if the parameter is positive or negative signaling NaN. |
|
These instructions return "true" if the parameter is negative, including negative zero, negative infinity and negative NaN. |
|
These functions return "true" if the parameter is a subnormal. |
|
These functions return "true" if the parameter is positive or negative zero. |
PROTOTYPE and Notes | Description |
---|---|
|
These functions return the negative of the absolute value of the parameter. |
Note: Also
see functions that transfer a
value from GPRs.
|
These functions transfer a value from an FPR or FPR pair to a GPR, GPR pair, or four GPRs. |
Note: Also
see functions that transfer a
value to GPRs.
|
These functions transfer a value from a GPR, GPR pair, or four GPRs to an FPR or FPR pair. |
The round_mode parameter must be a compile-time constant
expression. Use either of the following:
If
the input value is a signaling NaN, and:
|
These functions convert a value to a narrower format, with rounding control and invalid exception control that is unavailable when using a cast. |
Negative
values will be given the sign If If |
These functions convert the lower digits of the parameter to signed packed format. |
The signs
|
These functions convert signed packed decimal to decimal floating point. |
|
These functions convert the lower digits of the parameter to unsigned packed format. |
The round_mode parameter must be a compile-time constant
expression. Use either of the following:
|
These functions round a value to fewer digits.
They can temporarily override the current rounding mode. For correct
rounding, the input value must have been calculated using ROUND_TO_PREPARE_FOR |
Notes:
|
These functions return the digits and sign of the first parameter with the biased exponent of the second parameter, with special values for infinity, quiet NaN, or signaling NaN. |
|
These functions return the parameter with the coefficient shifted to the left. The sign and exponent are unchanged. The shift count must be in the 0-to-63 range; otherwise the result is undefined. |
|
These functions return the parameter with the coefficient shifted to the right. The sign and exponent are unchanged. The shift count must be in the 0-to-63 range; otherwise the result is undefined. |
These functions:
|
These functions determine whether a parameter is in a defined data class or a set of data classes, by testing its exponent and sign. |
These functions:
|
These functions determine whether a parameter is in a defined data group or set of data groups, by testing its exponent, sign and first digit. |
|
These functions return the exponent of the parameter as an integer. |
Positive values will be given the sign 0xC if CorF is false or 0xF if it is true. Negative values will be given the sign 0xD.
__d128_to_unsigned_BCD produces 32 decimal digits with no sign in a 128-bit
result. Note: Any digits to the left of those are ignored.
To access the ignored digits, use the appropriate
__d#_shift_right function. |
These functions convert the lower digits of the parameter to unsigned packed format. |
If both exponents are finite, these return "<0", "==0" or ">0" to indicate the relation between the exponents. If both exponents are infinite, they return "0". If one exponent is infinite and the other is finite, they return "-2" (unordered). |
These functions compare exponents to one another. |
|
These functions normally return the number of
significant digits in the input value. Exceptions:
|
|
This function modifies the Floating Point Control (FCP) register, and could raise an exception. |
PROTOTYPE and Notes | Description |
---|---|
The The The The return value is the converted decimal floating-point value. |
These functions convert zoned type to decimal floating-point type. |
The The The The The return value is the condition code set by the instruction. |
These functions convert decimal floating-point type to zoned type. |