quantized64.3m (2010 09)
q
quantized64(3M) quantized64(3M)
(HP Integrity Server Only)
NAME
quantized64(), quantized128(), quantized32() - decimal quantize functions
SYNOPSIS
#define __STDC_WANT_DEC_FP__
#include <math.h>
_Decimal64 quantized64(_Decimal64 x, _Decimal64 y);
_Decimal128 quantized128(_Decimal128 x, _Decimal128 y);
_Decimal32 quantized32(_Decimal32 x, _Decimal32 y);
DESCRIPTION
The quantized64()
function sets the exponent of x to the exponent of y, while attempting to keep the
value the same. If the exponent is being increased, the value is correctly rounded according to the current
(decimal) rounding mode.
quantized64()
is useful for rounding to a specified number of decimal places. For example,
quantized64(x, 0.0000DD) will round x to four places to the right of the decimal point (provided
the significand has enough digits to do so).
quantized128() is a
_Decimal128 version of quantized64(); it takes _Decimal128 argu-
ments and returns a
_Decimal128 result.
quantized32() is a _Decimal32
version of quantized64(); it takes _Decimal32 arguments
and returns a
_Decimal32 result.
These math functions are supported for HP-UX 11i Version 3 September 2008 Update and forward.
USAGE
To use any of these functions, compile with the +decfp option.
Make sure your program defines
__STDC_WANT_DEC_FP__
and then includes <math.h>.
Link in the math library by specifying
-lm or -l:libm.a on the linking command line.
For more information, see the HP-UX floating-point guide for HP Integrity servers at the following site:
http://www.hp.com/go/fp
.
RETURN VALUE
If the exponent of x is being increased and rounding produces a result whose numerical value is different
from x, then
quantized64()
raises the inexact exception.
If the exponent of x is being decreased and the
significand of the result has more digits than the type
would allow, quantized64() returns NaN and raises the invalid exception.
If one or both arguments are NaN, then
quantized64()
returns NaN.
Otherwise, if only one argument is ±infinity,
quantized64() returns NaN and raises the invalid
exception.
If both arguments are ±infinity,
quantized64() returns x.
ERRORS
No errors are defined.
SEE ALSO
quantexpd64(3M), samequantumd64(3M), math(5).
STANDARDS CONFORMANCE
These functions conform to ISO/IEC TR 24732, "Extension for the programming language C to support
decimal floating-point arithmetic".
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1