Sets the exponent of the first parameter to the exponent of the second parameter, attempting to keep the value the same.
#include <math.h>
_Decimal32 quantized32 (x, y)
_Decimal32 x;
_Decimal32 y;
_Decimal64 quantized64 (x, y)
_Decimal64 x;
_Decimal64 y;
_Decimal128 quantized128 (x, y)
_Decimal128 x;
_Decimal128 y;
The quantized32, quantized64, and quantized128 subroutines set the exponent of the x parameter to the exponent of y parameter, while attempting to keep the value of the x parameter the same. If the exponent is increased, the value is correctly rounded according to the current rounding mode; if the result does not have the same value as that of the x parameter, the inexact floating-point exception is raised. If the exponent is decreased and the significand of the result has more digits than the type allows, the result is NaN and the invalid floating-point exception is raised.
If one or both of the operands are NaN, the result is NaN. If only one operand is infinite, the result is NaN and the invalid floating-point exception is raised. If both operands are infinite, the result is DEC_INFINITY and the sign is the same as that of the x parameter.
An application checking for error situations should set the value of the errno global variable to zero and call the feclearexcept (FE_ALL_EXCEPT) subroutine before calling these subroutines. Upon return, if the value of the errno global variable is nonzero or the return value of the fetestexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW) subroutine is nonzero, an error has occurred.
Item | Description |
---|---|
x | Specifies the value to be computed. |
y | Specifies the value to be computed. |
The quantized32, quantized64, and quantized128 subroutines return the number that is equal to the x parameter in value (except for any rounding) and sign and has an exponent equal to that of the y parameter.