|
BDE 4.14.0 Production release
|
#include <bdldfp_decimalutil.h>
Static Public Member Functions | |
| static Decimal32 | makeDecimalRaw32 (int significand, int exponent) |
| static Decimal64 | makeDecimalRaw64 (int significand, int exponent) |
| static Decimal64 | makeDecimalRaw64 (unsigned int significand, int exponent) |
| static Decimal64 | makeDecimalRaw64 (long long significand, int exponent) |
| static Decimal64 | makeDecimalRaw64 (unsigned long long significand, int exponent) |
| static Decimal128 | makeDecimalRaw128 (int significand, int exponent) |
| static Decimal128 | makeDecimalRaw128 (unsigned int significand, int exponent) |
| static Decimal128 | makeDecimalRaw128 (long long significand, int exponent) |
| static Decimal128 | makeDecimalRaw128 (unsigned long long significand, int exponent) |
| static Decimal64 | makeDecimal64 (int significand, int exponent) |
| static Decimal64 | makeDecimal64 (unsigned int significand, int exponent) |
| static Decimal64 | makeDecimal64 (long long significand, int exponent) |
| static Decimal64 | makeDecimal64 (unsigned long long significand, int exponent) |
| static int | parseDecimal32 (Decimal32 *out, const char *str) |
| static int | parseDecimal64 (Decimal64 *out, const char *str) |
| static int | parseDecimal128 (Decimal128 *out, const char *str) |
| template<class STRING_TYPE > | |
| static int | parseDecimal32 (Decimal32 *out, const STRING_TYPE &str) |
| template<class STRING_TYPE > | |
| static int | parseDecimal64 (Decimal64 *out, const STRING_TYPE &str) |
| template<class STRING_TYPE > | |
| static int | parseDecimal128 (Decimal128 *out, const STRING_TYPE &str) |
| static int | parseDecimal32Exact (Decimal32 *out, const char *str) |
| static int | parseDecimal64Exact (Decimal64 *out, const char *str) |
| static int | parseDecimal128Exact (Decimal128 *out, const char *str) |
| template<class STRING_TYPE > | |
| static int | parseDecimal32Exact (Decimal32 *out, const STRING_TYPE &str) |
| template<class STRING_TYPE > | |
| static int | parseDecimal64Exact (Decimal64 *out, const STRING_TYPE &str) |
| template<class STRING_TYPE > | |
| static int | parseDecimal128Exact (Decimal128 *out, const STRING_TYPE &str) |
| static Decimal32 | copySign (Decimal32 x, Decimal32 y) |
| static Decimal64 | copySign (Decimal64 x, Decimal64 y) |
| static Decimal128 | copySign (Decimal128 x, Decimal128 y) |
| static Decimal32 | exp (Decimal32 x) |
| static Decimal64 | exp (Decimal64 x) |
| static Decimal128 | exp (Decimal128 x) |
| static Decimal32 | log (Decimal32 x) |
| static Decimal64 | log (Decimal64 x) |
| static Decimal128 | log (Decimal128 x) |
| static Decimal32 | logB (Decimal32 x) |
| static Decimal64 | logB (Decimal64 x) |
| static Decimal128 | logB (Decimal128 x) |
| static Decimal32 | log10 (Decimal32 x) |
| static Decimal64 | log10 (Decimal64 x) |
| static Decimal128 | log10 (Decimal128 x) |
| static Decimal32 | fmod (Decimal32 x, Decimal32 y) |
| static Decimal64 | fmod (Decimal64 x, Decimal64 y) |
| static Decimal128 | fmod (Decimal128 x, Decimal128 y) |
| static Decimal32 | remainder (Decimal32 x, Decimal32 y) |
| static Decimal64 | remainder (Decimal64 x, Decimal64 y) |
| static Decimal128 | remainder (Decimal128 x, Decimal128 y) |
| static long int | lrint (Decimal32 x) |
| static long int | lrint (Decimal64 x) |
| static long int | lrint (Decimal128 x) |
| static long long int | llrint (Decimal32 x) |
| static long long int | llrint (Decimal64 x) |
| static long long int | llrint (Decimal128 x) |
| static Decimal32 | nextafter (Decimal32 from, Decimal32 to) |
| static Decimal64 | nextafter (Decimal64 from, Decimal64 to) |
| static Decimal128 | nextafter (Decimal128 from, Decimal128 to) |
| static Decimal32 | nexttoward (Decimal32 from, Decimal128 to) |
| static Decimal64 | nexttoward (Decimal64 from, Decimal128 to) |
| static Decimal128 | nexttoward (Decimal128 from, Decimal128 to) |
| static Decimal32 | pow (Decimal32 base, Decimal32 exp) |
| static Decimal64 | pow (Decimal64 base, Decimal64 exp) |
| static Decimal128 | pow (Decimal128 base, Decimal128 exp) |
| static Decimal32 | fma (Decimal32 x, Decimal32 y, Decimal32 z) |
| static Decimal64 | fma (Decimal64 x, Decimal64 y, Decimal64 z) |
| static Decimal128 | fma (Decimal128 x, Decimal128 y, Decimal128 z) |
| static Decimal32 | fabs (Decimal32 value) |
| static Decimal64 | fabs (Decimal64 value) |
| static Decimal128 | fabs (Decimal128 value) |
| static Decimal32 | sqrt (Decimal32 x) |
| static Decimal64 | sqrt (Decimal64 x) |
| static Decimal128 | sqrt (Decimal128 x) |
| static int | classify (Decimal32 x) |
| static int | classify (Decimal64 x) |
| static int | classify (Decimal128 x) |
| static bool | isFinite (Decimal32 x) |
| static bool | isFinite (Decimal64 x) |
| static bool | isFinite (Decimal128 x) |
| static bool | isInf (Decimal32 x) |
| static bool | isInf (Decimal64 x) |
| static bool | isInf (Decimal128 x) |
| static bool | isNan (Decimal32 x) |
| static bool | isNan (Decimal64 x) |
| static bool | isNan (Decimal128 x) |
| static bool | isNormal (Decimal32 x) |
| static bool | isNormal (Decimal64 x) |
| static bool | isNormal (Decimal128 x) |
| static bool | isUnordered (Decimal32 x, Decimal32 y) |
| static bool | isUnordered (Decimal64 x, Decimal64 y) |
| static bool | isUnordered (Decimal128 x, Decimal128 y) |
| static Decimal32 | ceil (Decimal32 x) |
| static Decimal64 | ceil (Decimal64 x) |
| static Decimal128 | ceil (Decimal128 x) |
Examples: ceil(0.5) ==> 1.0; ceil(-0.5) ==> 0.0. | |
| static Decimal32 | floor (Decimal32 x) |
| static Decimal64 | floor (Decimal64 x) |
| static Decimal128 | floor (Decimal128 x) |
Examples: floor(0.5) ==> 0.0; floor(-0.5) ==> -1.0. | |
| static Decimal32 | round (Decimal32 x) |
| static Decimal64 | round (Decimal64 x) |
| static Decimal128 | round (Decimal128 x) |
Examples: round(0.5) ==> 1.0; round(-0.5) ==> -1.0. | |
| static long int | lround (Decimal32 x) |
| static long int | lround (Decimal64 x) |
| static long int | lround (Decimal128 x) |
Examples: lround(0.5) ==> 1.0; lround(-0.5) ==> -1.0. | |
| static Decimal32 | round (Decimal32 x, unsigned int precision) |
| static Decimal64 | round (Decimal64 x, unsigned int precision) |
| static Decimal128 | round (Decimal128 x, unsigned int precision) |
Examples: round(3.14159, 3) ==> 3.142. | |
| static Decimal32 | trunc (Decimal32 x) |
| static Decimal64 | trunc (Decimal64 x) |
| static Decimal128 | trunc (Decimal128 x) |
Examples: trunc(0.5) ==> 0.0; trunc(-0.5) ==> 0.0. | |
| static Decimal32 | trunc (Decimal32 x, unsigned int precision) |
| static Decimal64 | trunc (Decimal64 x, unsigned int precision) |
| static Decimal128 | trunc (Decimal128 x, unsigned int precision) |
Examples: trunc(3.14159, 3) ==> 3.141. | |
| static Decimal32 | multiplyByPowerOf10 (Decimal32 value, int exponent) |
| static Decimal64 | multiplyByPowerOf10 (Decimal64 value, int exponent) |
| static Decimal128 | multiplyByPowerOf10 (Decimal128 value, int exponent) |
| static Decimal32 | quantize (Decimal32 value, Decimal32 exponent) |
| static Decimal64 | quantize (Decimal64 value, Decimal64 exponent) |
| static Decimal128 | quantize (Decimal128 value, Decimal128 exponent) |
| static Decimal32 | quantize (Decimal32 value, int exponent) |
| static Decimal64 | quantize (Decimal64 value, int exponent) |
| static Decimal128 | quantize (Decimal128 value, int exponent) |
| static int | quantizeEqual (Decimal32 *x, Decimal32 y, int exponent) |
| static int | quantizeEqual (Decimal64 *x, Decimal64 y, int exponent) |
| static int | quantizeEqual (Decimal128 *x, Decimal128 y, int exponent) |
| static int | quantum (Decimal32 value) |
| static int | quantum (Decimal64 value) |
| static int | quantum (Decimal128 value) |
| static bool | sameQuantum (Decimal32 x, Decimal32 y) |
| static bool | sameQuantum (Decimal64 x, Decimal64 y) |
| static bool | sameQuantum (Decimal128 x, Decimal128 y) |
| static int | decompose (int *sign, unsigned int *significand, int *exponent, Decimal32 value) |
| static int | decompose (int *sign, bsls::Types::Uint64 *significand, int *exponent, Decimal64 value) |
| static int | decompose (int *sign, Uint128 *significand, int *exponent, Decimal128 value) |
| static int | format (char *buffer, int length, Decimal32 value, const DecimalFormatConfig &cfg=DecimalFormatConfig()) |
| static int | format (char *buffer, int length, Decimal64 value, const DecimalFormatConfig &cfg=DecimalFormatConfig()) |
| static int | format (char *buffer, int length, Decimal128 value, const DecimalFormatConfig &cfg=DecimalFormatConfig()) |
This utility struct provides a namespace for functions using the decimal floating point types defined in the bdldfp_decimal package.
|
inlinestatic |
Return the smallest integral value that is not less than the specified x.
Special value handling:
x is quiet NaN, quiet NaN is returned.x is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.x is +/-infinity or +/-0, it is returned unmodified.
|
static |
Note that the mention FP_XXX constants are C99 standard macros and they are defined in the math.h (cmath) standard header. On systems that fail to define those standard macros we define the in this component as public macros.
|
static |
Return the integer value that respresents the floating point classification of the specified x value as follows:
x is NaN, return FP_NAN;x is positive or negative infinity, return FP_INFINITE;x is a subnormal value, return FP_SUBNORMALx is a zero value, return FP_ZEROFP_NORMAL
|
static |
|
inlinestatic |
Examples: copySign( 5.0, -2.0) ==> -5.0; copySign(-5.0, -2.0) ==> 5.0
Return a decimal value with the magnitude of the specifed x and the sign of the specified y. If x is NaN, then NaN with the sign of y is returned.
|
static |
|
static |
Note that a decomposed representation may not be unique, for example 10 can be represented as either 10 * (10 ** 0) or 1 * (10 ** 1). The returned significand and exponent reflect the encoded representation of value (i.e., they reflect the quantum of value).
|
static |
Decompose the specified decimal value into the components of the decimal floating-point format and load the result into the specified sign, significand and exponent such that value is equal to sign * significand * (10 ** exponent). The special values infinity and NaNs are decomposed to sign, exponent and significand parts, even though they don't have their normal meaning (except sign). That is those specific values cannot be restored using these parts, unlike the finite ones. Return the integer value that represents the floating point classification of the specified value as follows:
value is NaN, return FP_NAN;value is infinity, return FP_INFINITE;value is a subnormal value, return FP_SUBNORMAL;value is a zero value, return FP_ZERO;FP_NORMAL.
|
inlinestatic |
Special value handling:
x is +/-0, 1 is returned.x is negative infinity, +0 is returned.x is +infinity, +infinity is returned.x is quiet NaN, quiet NaN is returned.x is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.x is finite, but the result value is outside the range of the return type, store the value of the macro ERANGE into errno and +infinity value is returned. Return e (Euler's number, 2.7182818) raised to the specified power x.
|
inlinestatic |
Special value handling:
x is NaN (either signaling or quiet), quiet NaN is returned.x is +/-infinity or +/-0, it is returned unmodified. Return the absolute value of the specified x.
|
inlinestatic |
Return the largest integral value that is not greater than the specified x.
Special value handling:
x is quiet NaN, quiet NaN is returned.x is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.x is +/-infinity or +/-0, it is returned unmodified.
|
inlinestatic |
Special value handling:
x or y are quiet NaN, quiet NaN is returned.EDOM is stored into errno.x*y is an exact infinity and z is an infinity with the opposite sign, quiet NaN is returned and the value of the macro EDOM is stored into errno.x is zero and y is infinite or if x is infinite and y is zero, and z is not a NaN, then quiet NaN is returned and the value of the macro EDOM is stored into errno.x is zero and y is infinite or if x is infinite and y is zero, and z is NaN, then quiet NaN is returned. Return, using the specified x, y, and z, the value of the expression x * y + z, rounded as one ternary operation according to the current decimal floating point rounding mode.
|
inlinestatic |
Special value handling:
EDOM is stored into errno.x is +/-infnity and y is not NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.x is +/-0 and y is not zero, +/-0 is returned.y is +/-0, quite NaN is returned and the value of the macro EDOM is stored into errno.x is finite and y is +/-infnity, x is returned. Return the remainder of the division of the specified x by the specified y. The returned value has the same sign as x and is less than y in magnitude.
|
static |
Format the specified value, placing the output in the buffer designated by the specified buffer and length, and return the length of the formatted value. If there is insufficient room in the buffer, its contents will be left in an unspecified state, with the returned value indicating the necessary size. This function does not write a terminating null character. If length is not positive, buffer is permitted to be null. This can be used to determine the necessary buffer size. Optionally specify a cfg, indicating formatting parameters. If cfg is not specified, then default configuration instance, indicating scientific notation style with a precision sufficient to produce all available digits is used. See the Attributes section for information on the configuration attributes.
Note that for some combinations of value and precision provided by cfg object, the number being written must first be rounded to fewer digits than it initially contains. The number written must be as close as possible to the initial value given the constraints on precision. The rounding should be done as "round-half-up", i.e., round up in magnitude when the first of the discarded digits is between 5 and 9.
Also note that if the configuration format attribute style is e_NATURAL then all significand digits of the value are output in the buffer regardless of the value specified in configuration's precision attribute.
|
static |
|
static |
|
static |
Return true if the specified x is not an infinity value or NaN and false otherwise. Note that this is equivalent to classify(x) != FP_INFINITE && classify(x) != FP_NAN.
|
static |
|
static |
|
static |
Return true if the specified x is an infinity value and false otherwise. Note that this is equivalent to classify(x) == FP_INFINITE.
|
static |
|
static |
|
static |
Return true if the specified x is NaN and false otherwise. Note that this is equivalent to classify(x) == FP_NAN.
|
static |
|
static |
|
static |
Return true if the specified x is a normal value and false otherwise. Note that this is equivalent to classify(x) == FP_NORMAL.
|
static |
|
static |
|
static |
Return true if either (or both) of the specified x and y arguments is a NaN, or false otherwise.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Special value handling:
x is +/-0, -infinity is returned and the value of the macro ERANGE is stored into errno.x is 1, +0 is returned.x is negative, quiet NaN is returned and the value of the macro EDOM is stored into errno.x is +infinity, +infinity is returned.x is quiet NaN, quiet NaN is returned.x is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno. Return the natural (base e) logarithm of the specified x.
|
inlinestatic |
Special value handling:
x is +/-0, -infinity is returned and the value of the macro ERANGE is stored into errno.x is 1, +0 is returned.x is negative, quiet NaN is returned and the value of the macro EDOM is stored into errno.x is +infinity, +infinity is returned.x is quiet NaN, quiet NaN is returned.x is signaling NaN, NaN is returned and the value of the macro EDOM is stored into errno. Return the common (base-10) logarithm of the specified x.
|
inlinestatic |
Examples: logB( 10.0) ==> 1.0; logB(-100.0) ==> 2.0
Return the FLT_RADIX-based logarithm (i.e., base 10) of the absolute value of the specified x.
Special value handling:
x is +/-0, -infinity is returned and the value of the macro ERANGE is stored into errno.x is 1, +0 is returned.x is +/-infinity, +infinity is returned.x is quiet NaN, quiet NaN is returned.x is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.
|
inlinestatic |
Special value handling:
EDOM is stored into errno.y is +/-0, quiet NaN is returned and the value of the macro EDOM is stored into errno.x is +/-infnity and y is not NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.x is finite and y is +/-infnity, x is returned.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Return the integral value nearest to the specified x. Round halfway cases away from zero, regardless of the current decimal floating point rounding mode.
Special value handling:
x is NaN (either quiet or signaling), quiet NaN is returned and the value of the macro EDOM is stored into errno.x is +/-infinity, quite NaN is returned and the value of the macro EDOM is stored into errno.EDOM is stored into errno.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Create a Deciaml128 object representing a decimal floating point number consisting of the specified significand and specified exponent, with the sign given by the significand (if signed). The behavior is undefined unless -6176 <= exponent <= 6111.
|
inlinestatic |
Create a Decimal32 object representing a decimal floating point number consisting of the specified significand and exponent, with the sign given by the significand (if signed). The behavior is undefined unless -9,999,999 <= significand <= 9,999,999 and -101 <= exponent <= 90.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Create a Decimal64 object representing a decimal floating point number consisting of the specified significand and exponent, with the sign given by the significand (if signed). The behavior is undefined unless -9,999,999,999,999,999 <= significand <= 9,999,999,999,999,999 and -398 <= exponent <= 369.
|
inlinestatic |
Special value handling:
value is quiet NaN, quiet NaN is returned.value is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.x is infinite, then infinity is returned.ERANGE is stored into errno. Return the result of multiplying the specified value by ten raised to the specified exponent. The quantum of value is scaled according to IEEE 754's scaleB operations.
|
inlinestatic |
Return an integer value nearest to the specified x. Round x using the current rounding mode. If x is +/-infnity, NaN (either signaling or quiet) or the rounded value is outside the range of the return type, store the value of the macro EDOM into errno and return implementation-defined value.
|
inlinestatic |
Special value handling:
from equals to, to is returned.EDOM is stored into errno.from is finite, but the expected result is an infinity, infinity is returned and the value of the macro ERANGE is stored into errno.from does not equal to and the result is subnormal or zero, the value of the macro ERANGE is stored into errno.
|
inlinestatic |
Return the next representable value of the specified from in the direction of the specified to.
|
inlinestatic |
|
static |
Return a DecimalNN object that has the specified significand and exponent, rounded according to the current decimal rounding mode, if necessary. If an overflow condition occurs, store the value of the macro ERANGE into errno and return infinity with the appropriate sign.
|
inlinestatic |
Load into the specified out the decimal floating point number described by the specified str; return zero if the conversion was successful and non-zero otherwise. The value of out is unspecified if the function returns a non-zero value. The parameterized STRING_TYPE must be one of bsl::string, std::string, std::pmr::string (if supported), or bslstl::StringRef.
|
static |
|
inlinestatic |
Load into the specified out the decimal floating point number described by the specified str. Return 0 if out is an exact representation of str, a positive value if str is an approximation of str (i.e., str could not be represented exactly), and a negative value if str could not be parsed. The value of out is unspecified if the function returns a negative value. The parameterized STRING_TYPE must be one of bsl::string, std::string, std::pmr::string (if supported), or bslstl::StringRef.
|
static |
|
inlinestatic |
|
static |
|
inlinestatic |
|
static |
|
inlinestatic |
|
static |
|
inlinestatic |
|
inlinestatic |
Special value handling:
base is finite and negative and exp is finite and non-integer, quiet NaN is returned and the value of the macro EDOM is stored into errno.ERANGE is stored into errno.ERANGE is stored into errno.EDOM is stored into errno. Return the value of the specified base raised to the power of the specified exp.
|
inlinestatic |
Return a number equal to the specified value (except for possible rounding) having the exponent equal to the exponent of the specified exponent. Rounding may occur when the exponent is greater than the quantum of value. E.g., quantize(147e-2_d32, 1e-1_d32) yields 15e-1_d32. In the opposite direction, if exponent is sufficiently less than the quantum of value, it may not be possible to construct the requested result, and if so, NaN is returned. E.g., quantize(1234567e0_d32, 1e-1_d32) returns NaN.
|
inlinestatic |
Return a number equal to the specified value (except for possible rounding) having the specified exponent. Rounding may occur when exponent is greater than the quantum of value. E.g., quantize(147e-2_d32, -1) yields 15e-1_d32. In the opposite direction, if exponent is sufficiently less than the quantum of value, it may not be possible to construct the requested result, and if so, NaN is returned. E.g., quantize(1234567e0_d32, -1) returns NaN. Behavior is undefined unless the exponent satisfies the following conditions
Decimal32 type: -101 <= exponent <= 90Decimal64 type: -398 <= exponent <= 369Decimal128 type: -6176 <= exponent <= 6111
|
inlinestatic |
Example: Decimal32 x; BSLS_ASSERT(0 == quantizeEqual(&x, 123e+3_d32, 2); BSLS_ASSERT(1230e+2_d32 == x); BSLS_ASSERT(0 != quantizeEqual(&x, 123e+3_d32, -2); BSLS_ASSERT(1230e+2_d32 == x);
If a floating-point number equal to the specified y and having the specified exponent can be constructed, set that value into the specified x and return 0. Otherwise, or if y is NaN or infinity, leave the contents of x unchanged and return a non-zero value. The behavior is undefined unless exponent satisfies the following conditions
Decimal32 type: -101 <= exponent <= 90Decimal64 type: -398 <= exponent <= 369Decimal128 type: -6176 <= exponent <= 6111
|
static |
Return an integer equal to the exponent field in the specified value. Each decimal floating point number is a representation of the ideal form s * (10 ** e), where s is significand and e is exponent. This function returns that exponent value. The behavior is undefined if value is NaN or value is infinity.
|
static |
|
static |
|
inlinestatic |
Return the remainder of the division of the specified x by the specified y. The remainder of the division operation x/y calculated by this function is exactly the value x - n*y, where n s the integral value nearest the exact value x/y. When |n - x/y| == 0.5, the value n is chosen to be even. Note that in contrast to DecimalImpUtil::fmod(), the returned value is not guaranteed to have the same sign as x.
|
inlinestatic |
|
inlinestatic |
Return the integral value nearest to the specified x. Round halfway cases away from zero, regardless of the current decimal floating point rounding mode.
Special value handling:
x is quiet NaN, quiet NaN is returned.x is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.x is +/-infinity or +/-0, it is returned unmodified. Return the specified x value rounded to the specified precision decimal places. Round halfway cases away from zero, regardless of the current decimal floating point rounding mode. If x is integral, positive zero, negative zero, NaN, or infinity then return x itself.
|
inlinestatic |
Return true if the specified x and y values have the same quantum exponents, and false otherwise. If both arguments are NaN or both arguments are infinity, they have the same quantum exponents. Note that if exactly one operand is NaN or exactly one operand is infinity, they do not have the same quantum exponents.
|
inlinestatic |
Special value handling:
x is NaN, NaN is returned.x is less than -0, NaN is returned and the value of the macro EDOM is stored into errno.x is +/-infinity or +/-0, it is returned unmodified. Return the square root of the specified x.
|
inlinestatic |
|
static |
Return the nearest integral value that is not greater in absolute value than the specified x.
Special value handling:
x is quiet NaN, quiet NaN is returned.x is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.x is +/-infinity or +/-0, it is returned unmodified. Return the specified x value truncated to the specified precision decimal places. Round towards zero, regardless of the current decimal floating point rounding mode. If precision of x is less than or equal the precision or x is positive zero, negative zero, NaN, or infinity then return x itself.