BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdldfp::DecimalImpUtil Class Reference

#include <bdldfp_decimalimputil.h>

Public Types

enum  { k_STATUS_INEXACT = Imp::k_STATUS_INEXACT , k_STATUS_UNDERFLOW = Imp::k_STATUS_UNDERFLOW , k_STATUS_OVERFLOW = Imp::k_STATUS_OVERFLOW }
 
typedef Imp::ValueType32 ValueType32
 
typedef Imp::ValueType64 ValueType64
 
typedef Imp::ValueType128 ValueType128
 

Static Public Member Functions

static ValueType64 makeDecimal64 (int significand, int exponent)
 
static ValueType64 makeDecimal64 (unsigned int significand, int exponent)
 
static ValueType64 makeDecimal64 (long long int significand, int exponent)
 
static ValueType64 makeDecimal64 (unsigned long long int significand, int exponent)
 
static ValueType64 makeInfinity64 (bool isNegative=false)
 
static int classify (ValueType32 x)
 
static int classify (ValueType64 x)
 
static int classify (ValueType128 x)
 
static ValueType32 normalize (ValueType32 original)
 
static ValueType64 normalize (ValueType64 original)
 
static ValueType128 normalize (ValueType128 original)
 
static ValueType32 quantize (ValueType32 value, ValueType32 exponent)
 
static ValueType64 quantize (ValueType64 value, ValueType64 exponent)
 
static ValueType128 quantize (ValueType128 value, ValueType128 exponent)
 
static ValueType32 quantize (ValueType32 value, int exponent)
 
static ValueType64 quantize (ValueType64 value, int exponent)
 
static ValueType128 quantize (ValueType128 value, int exponent)
 
static int quantizeEqual (ValueType32 *x, ValueType32 y, int exponent)
 
static int quantizeEqual (ValueType64 *x, ValueType64 y, int exponent)
 
static int quantizeEqual (ValueType128 *x, ValueType128 y, int exponent)
 
static bool sameQuantum (ValueType32 x, ValueType32 y)
 
static bool sameQuantum (ValueType64 x, ValueType64 y)
 
static bool sameQuantum (ValueType128 x, ValueType128 y)
 
static int decompose (int *sign, unsigned int *significand, int *exponent, ValueType32 value)
 
static int decompose (int *sign, bsls::Types::Uint64 *significand, int *exponent, ValueType64 value)
 
static int decompose (int *sign, Uint128 *significand, int *exponent, ValueType128 value)
 
static int format (char *buffer, int length, ValueType32 value, const DecimalFormatConfig &cfg)
 
static int format (char *buffer, int length, ValueType64 value, const DecimalFormatConfig &cfg)
 
static int format (char *buffer, int length, ValueType128 value, const DecimalFormatConfig &cfg)
 
static ValueType32 int32ToDecimal32 (int value)
 
static ValueType32 uint32ToDecimal32 (unsigned int value)
 
static ValueType32 int64ToDecimal32 (long long int value)
 
static ValueType32 uint64ToDecimal32 (unsigned long long int value)
 
static ValueType64 int32ToDecimal64 (int value)
 
static ValueType64 uint32ToDecimal64 (unsigned int value)
 
static ValueType64 int64ToDecimal64 (long long int value)
 
static ValueType64 uint64ToDecimal64 (unsigned long long int value)
 
static ValueType128 int32ToDecimal128 (int value)
 
static ValueType128 uint32ToDecimal128 (unsigned int value)
 
static ValueType128 int64ToDecimal128 (long long int value)
 
static ValueType128 uint64ToDecimal128 (unsigned long long int value)
 
static ValueType32 add (ValueType32 lhs, ValueType32 rhs)
 
static ValueType64 add (ValueType64 lhs, ValueType64 rhs)
 
static ValueType128 add (ValueType128 lhs, ValueType128 rhs)
 
static ValueType32 subtract (ValueType32 lhs, ValueType32 rhs)
 
static ValueType64 subtract (ValueType64 lhs, ValueType64 rhs)
 
static ValueType128 subtract (ValueType128 lhs, ValueType128 rhs)
 
static ValueType32 multiply (ValueType32 lhs, ValueType32 rhs)
 
static ValueType64 multiply (ValueType64 lhs, ValueType64 rhs)
 
static ValueType128 multiply (ValueType128 lhs, ValueType128 rhs)
 
static ValueType32 divide (ValueType32 lhs, ValueType32 rhs)
 
static ValueType64 divide (ValueType64 lhs, ValueType64 rhs)
 
static ValueType128 divide (ValueType128 lhs, ValueType128 rhs)
 
static ValueType32 copySign (ValueType32 x, ValueType32 y)
 
static ValueType64 copySign (ValueType64 x, ValueType64 y)
 
static ValueType128 copySign (ValueType128 x, ValueType128 y)
 
static ValueType32 exp (ValueType32 x)
 
static ValueType64 exp (ValueType64 x)
 
static ValueType128 exp (ValueType128 x)
 
static ValueType32 log (ValueType32 x)
 
static ValueType64 log (ValueType64 x)
 
static ValueType128 log (ValueType128 x)
 
static ValueType32 logB (ValueType32 x)
 
static ValueType64 logB (ValueType64 x)
 
static ValueType128 logB (ValueType128 x)
 
static ValueType32 log10 (ValueType32 x)
 
static ValueType64 log10 (ValueType64 x)
 
static ValueType128 log10 (ValueType128 x)
 
static ValueType32 fmod (ValueType32 x, ValueType32 y)
 
static ValueType64 fmod (ValueType64 x, ValueType64 y)
 
static ValueType128 fmod (ValueType128 x, ValueType128 y)
 
static ValueType32 remainder (ValueType32 x, ValueType32 y)
 
static ValueType64 remainder (ValueType64 x, ValueType64 y)
 
static ValueType128 remainder (ValueType128 x, ValueType128 y)
 
static long int lrint (ValueType32 x)
 
static long int lrint (ValueType64 x)
 
static long int lrint (ValueType128 x)
 
static long long int llrint (ValueType32 x)
 
static long long int llrint (ValueType64 x)
 
static long long int llrint (ValueType128 x)
 
static ValueType32 nextafter (ValueType32 from, ValueType32 to)
 
static ValueType64 nextafter (ValueType64 from, ValueType64 to)
 
static ValueType128 nextafter (ValueType128 from, ValueType128 to)
 
static ValueType32 nexttoward (ValueType32 from, ValueType128 to)
 
static ValueType64 nexttoward (ValueType64 from, ValueType128 to)
 
static ValueType128 nexttoward (ValueType128 from, ValueType128 to)
 
static ValueType32 pow (ValueType32 base, ValueType32 exp)
 
static ValueType64 pow (ValueType64 base, ValueType64 exp)
 
static ValueType128 pow (ValueType128 base, ValueType128 exp)
 
static ValueType32 ceil (ValueType32 x)
 
static ValueType64 ceil (ValueType64 x)
 
static ValueType128 ceil (ValueType128 x)
 Examples: ceil(0.5) ==> 1.0; ceil(-0.5) ==> 0.0.
 
static ValueType32 floor (ValueType32 x)
 
static ValueType64 floor (ValueType64 x)
 
static ValueType128 floor (ValueType128 x)
 Examples: floor(0.5) ==> 0.0; floor(-0.5) ==> -1.0.
 
static ValueType32 round (ValueType32 x)
 
static ValueType64 round (ValueType64 x)
 
static ValueType128 round (ValueType128 x)
 Examples: round(0.5) ==> 1.0; round(-0.5) ==> -1.0.
 
static long int lround (ValueType32 x)
 
static long int lround (ValueType64 x)
 
static long int lround (ValueType128 x)
 Examples: lround(0.5) ==> 1.0; lround(-0.5) ==> -1.0.
 
static ValueType32 round (ValueType32 x, unsigned int precision)
 
static ValueType64 round (ValueType64 x, unsigned int precision)
 
static ValueType128 round (ValueType128 x, unsigned int precision)
 Examples: round(3.14159, 3) ==> 3.142.
 
static ValueType32 trunc (ValueType32 x)
 
static ValueType64 trunc (ValueType64 x)
 
static ValueType128 trunc (ValueType128 x)
 Examples: trunc(0.5) ==> 0.0; trunc(-0.5) ==> 0.0.
 
static ValueType32 fma (ValueType32 x, ValueType32 y, ValueType32 z)
 
static ValueType64 fma (ValueType64 x, ValueType64 y, ValueType64 z)
 
static ValueType128 fma (ValueType128 x, ValueType128 y, ValueType128 z)
 
static ValueType32 fabs (ValueType32 x)
 
static ValueType64 fabs (ValueType64 x)
 
static ValueType128 fabs (ValueType128 x)
 
static ValueType32 sqrt (ValueType32 x)
 
static ValueType64 sqrt (ValueType64 x)
 
static ValueType128 sqrt (ValueType128 x)
 
static ValueType32 negate (ValueType32 value)
 
static ValueType64 negate (ValueType64 value)
 
static ValueType128 negate (ValueType128 value)
 
static bool less (ValueType32 lhs, ValueType32 rhs)
 
static bool less (ValueType64 lhs, ValueType64 rhs)
 
static bool less (ValueType128 lhs, ValueType128 rhs)
 
static bool greater (ValueType32 lhs, ValueType32 rhs)
 
static bool greater (ValueType64 lhs, ValueType64 rhs)
 
static bool greater (ValueType128 lhs, ValueType128 rhs)
 
static bool lessEqual (ValueType32 lhs, ValueType32 rhs)
 
static bool lessEqual (ValueType64 lhs, ValueType64 rhs)
 
static bool lessEqual (ValueType128 lhs, ValueType128 rhs)
 
static bool greaterEqual (ValueType32 lhs, ValueType32 rhs)
 
static bool greaterEqual (ValueType64 lhs, ValueType64 rhs)
 
static bool greaterEqual (ValueType128 lhs, ValueType128 rhs)
 
static bool equal (ValueType32 lhs, ValueType32 rhs)
 
static bool equal (ValueType64 lhs, ValueType64 rhs)
 
static bool equal (ValueType128 lhs, ValueType128 rhs)
 
static bool notEqual (ValueType32 lhs, ValueType32 rhs)
 
static bool notEqual (ValueType64 lhs, ValueType64 rhs)
 
static bool notEqual (ValueType128 lhs, ValueType128 rhs)
 
static ValueType32 convertToDecimal32 (const ValueType64 &input)
 
static ValueType32 convertToDecimal32 (const ValueType128 &input)
 
static ValueType64 convertToDecimal64 (const ValueType32 &input)
 
static ValueType64 convertToDecimal64 (const ValueType128 &input)
 
static ValueType128 convertToDecimal128 (const ValueType32 &input)
 
static ValueType128 convertToDecimal128 (const ValueType64 &input)
 
static ValueType32 binaryToDecimal32 (float value)
 
static ValueType32 binaryToDecimal32 (double value)
 
static ValueType64 binaryToDecimal64 (float value)
 
static ValueType64 binaryToDecimal64 (double value)
 
static ValueType128 binaryToDecimal128 (float value)
 
static ValueType128 binaryToDecimal128 (double value)
 
static ValueType32 makeDecimalRaw32 (int significand, int exponent)
 
static ValueType64 makeDecimalRaw64 (unsigned long long int significand, int exponent)
 
static ValueType64 makeDecimalRaw64 (long long int significand, int exponent)
 
static ValueType64 makeDecimalRaw64 (unsigned int significand, int exponent)
 
static ValueType64 makeDecimalRaw64 (int significand, int exponent)
 
static ValueType128 makeDecimalRaw128 (unsigned long long int significand, int exponent)
 
static ValueType128 makeDecimalRaw128 (long long int significand, int exponent)
 
static ValueType128 makeDecimalRaw128 (unsigned int significand, int exponent)
 
static ValueType128 makeDecimalRaw128 (int significand, int exponent)
 
static ValueType32 scaleB (ValueType32 value, int exponent)
 
static ValueType64 scaleB (ValueType64 value, int exponent)
 
static ValueType128 scaleB (ValueType128 value, int exponent)
 
static ValueType32 parse32 (const char *input)
 
static ValueType64 parse64 (const char *input)
 
static ValueType128 parse128 (const char *input)
 
static ValueType32 parse32 (const char *input, unsigned int *status)
 
static ValueType64 parse64 (const char *input, unsigned int *status)
 
static ValueType128 parse128 (const char *input, unsigned int *status)
 
static ValueType32 convertDPDtoBID (DecimalStorage::Type32 dpd)
 
static ValueType64 convertDPDtoBID (DecimalStorage::Type64 dpd)
 
static ValueType128 convertDPDtoBID (DecimalStorage::Type128 dpd)
 
static DecimalStorage::Type32 convertBIDtoDPD (ValueType32 value)
 
static DecimalStorage::Type64 convertBIDtoDPD (ValueType64 value)
 
static DecimalStorage::Type128 convertBIDtoDPD (ValueType128 value)
 
static ValueType32 convertFromBID (DecimalStorage::Type32 bid)
 
static ValueType64 convertFromBID (DecimalStorage::Type64 bid)
 
static ValueType128 convertFromBID (DecimalStorage::Type128 bid)
 
static DecimalStorage::Type32 convertToBID (ValueType32 value)
 
static DecimalStorage::Type64 convertToBID (ValueType64 value)
 
static DecimalStorage::Type128 convertToBID (ValueType128 value)
 
static ValueType32 min32 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType32 max32 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType32 epsilon32 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType32 roundError32 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType32 denormMin32 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType32 infinity32 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType32 quietNaN32 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType32 signalingNaN32 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType64 min64 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType64 max64 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType64 epsilon64 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType64 roundError64 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType64 denormMin64 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType64 infinity64 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType64 quietNaN64 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType64 signalingNaN64 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType128 min128 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType128 max128 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType128 epsilon128 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType128 roundError128 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType128 denormMin128 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType128 infinity128 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType128 quietNaN128 () BSLS_KEYWORD_NOEXCEPT
 
static ValueType128 signalingNaN128 () BSLS_KEYWORD_NOEXCEPT
 

Detailed Description

This struct provides a namespace for utility functions that implement core decimal floating-poing operations.

See bdldfp_decimalimputil

Member Typedef Documentation

◆ ValueType128

typedef Imp::ValueType128 bdldfp::DecimalImpUtil::ValueType128

◆ ValueType32

typedef Imp::ValueType32 bdldfp::DecimalImpUtil::ValueType32

◆ ValueType64

typedef Imp::ValueType64 bdldfp::DecimalImpUtil::ValueType64

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
k_STATUS_INEXACT 
k_STATUS_UNDERFLOW 
k_STATUS_OVERFLOW 

Member Function Documentation

◆ add() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::add ( DecimalImpUtil::ValueType128  lhs,
DecimalImpUtil::ValueType128  rhs 
)
inlinestatic
  • If either of lhs or rhs is signaling NaN, then store the value of the macro EDOM into errno and return a NaN.
  • Otherwise if either of lhs or rhs is NaN, return a NaN.
  • Otherwise if lhs and rhs are infinities of differing signs, store the value of the macro EDOM into errno and return a NaN.
  • Otherwise if lhs and rhs are infinities of the same sign then return infinity of that sign.
  • Otherwise if rhs is zero (positive or negative), return lhs.
  • Otherwise if the sum of lhs and rhs has an absolute value that is larger than the maximum value supported by the indicated result type then store the value of the macro ERANGE into errno and return infinity with the same sign as that result.
  • Otherwise return the sum of the number represented by lhs and the number represented by rhs.

◆ add() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::add ( DecimalImpUtil::ValueType32  lhs,
DecimalImpUtil::ValueType32  rhs 
)
inlinestatic

Add the value of the specified rhs to the value of the specified lhs as described by IEEE-754 and return the result.

◆ add() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::add ( DecimalImpUtil::ValueType64  lhs,
DecimalImpUtil::ValueType64  rhs 
)
inlinestatic

◆ binaryToDecimal128() [1/2]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::binaryToDecimal128 ( double  value)
inlinestatic
  • If value is signaling NaN, store the value of the macro EDOM into errno and return signaling NaN value.
  • Otherwise if value is NaN, return a NaN.
  • Otherwise if value is infinity (positive or negative), then return an object equal to infinity with the same sign.
  • Otherwise if value is a zero value, then return an object equal to zero with the same sign.
  • Otherwise if value has an absolute value that is larger than std::numeric_limits<Decimal128>::max() then store the value of the macro ERANGE into errno and return infinity with the same sign as value.
  • Otherwise if value has an absolute value that is smaller than std::numeric_limits<Decimal128>::min() then store the value of the macro ERANGE into errno and return a zero with the same sign as value.
  • Otherwise if value needs more than std::numeric_limits<Decimal128>::max_digit significant decimal digits to represent then return the value rounded according to the rounding direction.
  • Otherwise return a Decimal128 object representing value.

◆ binaryToDecimal128() [2/2]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::binaryToDecimal128 ( float  value)
inlinestatic

Create a Decimal128 object having the value closest to the specified value following the conversion rules as defined by IEEE-754:

◆ binaryToDecimal32() [1/2]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::binaryToDecimal32 ( double  value)
inlinestatic
  • If value is signaling NaN, store the value of the macro EDOM into errno and return signaling NaN value.
  • Otherwise if value is NaN, return a NaN.
  • Otherwise if value is infinity (positive or negative), then return an object equal to infinity with the same sign.
  • Otherwise if value is a zero value, then return an object equal to zero with the same sign.
  • Otherwise if value has an absolute value that is larger than std::numeric_limits<Decimal32>::max() then store the value of the macro ERANGE into errno and return infinity with the same sign as value.
  • Otherwise if value has an absolute value that is smaller than std::numeric_limits<Decimal32>::min() then store the value of the macro ERANGE into errno and return a zero with the same sign as value.
  • Otherwise if value needs more than std::numeric_limits<Decimal32>::max_digit significant decimal digits to represent then return the value rounded according to the rounding direction.
  • Otherwise return a Decimal32 object representing value.

◆ binaryToDecimal32() [2/2]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::binaryToDecimal32 ( float  value)
inlinestatic

Create a Decimal32 object having the value closest to the specified value following the conversion rules as defined by IEEE-754:

◆ binaryToDecimal64() [1/2]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::binaryToDecimal64 ( double  value)
inlinestatic
  • If value is signaling NaN, store the value of the macro EDOM into errno and return signaling NaN value.
  • Otherwise if value is NaN, return a NaN.
  • Otherwise if value is infinity (positive or negative), then return an object equal to infinity with the same sign.
  • Otherwise if value is a zero value, then return an object equal to zero with the same sign.
  • Otherwise if value needs more than std::numeric_limits<Decimal64>::max_digit significant decimal digits to represent then return the value rounded according to the rounding direction.
  • Otherwise return a Decimal64 object representing value.

◆ binaryToDecimal64() [2/2]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::binaryToDecimal64 ( float  value)
inlinestatic

Create a Decimal64 object having the value closest to the specified value following the conversion rules as defined by IEEE-754:

◆ ceil() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::ceil ( ValueType128  x)
inlinestatic

◆ ceil() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::ceil ( ValueType32  x)
inlinestatic

Return the smallest integral value that is not less than the specified x.

Special value handling:

  • if x is quiet NaN, quiet NaN is returned.
  • If x is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.
  • if x is +/-infinity or +/-0, it is returned unmodified.

◆ ceil() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::ceil ( ValueType64  x)
inlinestatic

◆ classify() [1/3]

static int bdldfp::DecimalImpUtil::classify ( ValueType128  x)
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.

◆ classify() [2/3]

static int bdldfp::DecimalImpUtil::classify ( ValueType32  x)
static

Return the integer value that respresents the floating point classification of the specified x value as follows:

  • if x is NaN, return FP_NAN;
  • otherwise if x is positive or negative infinity, return FP_INFINITE;
  • otherwise if x is a subnormal value, return FP_SUBNORMAL
  • otherwise if x is a zero value, return FP_ZERO
  • otherwise return FP_NORMAL

◆ classify() [3/3]

static int bdldfp::DecimalImpUtil::classify ( ValueType64  x)
static

◆ convertBIDtoDPD() [1/3]

DecimalStorage::Type128 bdldfp::DecimalImpUtil::convertBIDtoDPD ( ValueType128  value)
inlinestatic

◆ convertBIDtoDPD() [2/3]

DecimalStorage::Type32 bdldfp::DecimalImpUtil::convertBIDtoDPD ( ValueType32  value)
inlinestatic

Return a DecimalStorage::TypeXX representing the specified value in Densely Packed Decimal (DPD) format. This format is compatible with the IBM compiler's native type.

◆ convertBIDtoDPD() [3/3]

DecimalStorage::Type64 bdldfp::DecimalImpUtil::convertBIDtoDPD ( ValueType64  value)
inlinestatic

◆ convertDPDtoBID() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::convertDPDtoBID ( DecimalStorage::Type128  dpd)
inlinestatic

Return a ValueTypeXX representing the specified dpd, which is currently in Densely Packed Decimal (DPD) format. This format is compatible with the IBM compiler's native type.

◆ convertDPDtoBID() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::convertDPDtoBID ( DecimalStorage::Type32  dpd)
inlinestatic

◆ convertDPDtoBID() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::convertDPDtoBID ( DecimalStorage::Type64  dpd)
inlinestatic

◆ convertFromBID() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::convertFromBID ( DecimalStorage::Type128  bid)
inlinestatic

Return a ValueTypeXX representing the specified bid, which is currently in Binary Integral Decimal (BID) format. This format is compatible with the Intel DFP implementation type.

◆ convertFromBID() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::convertFromBID ( DecimalStorage::Type32  bid)
inlinestatic

◆ convertFromBID() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::convertFromBID ( DecimalStorage::Type64  bid)
inlinestatic

◆ convertToBID() [1/3]

DecimalStorage::Type128 bdldfp::DecimalImpUtil::convertToBID ( ValueType128  value)
inlinestatic

◆ convertToBID() [2/3]

DecimalStorage::Type32 bdldfp::DecimalImpUtil::convertToBID ( ValueType32  value)
inlinestatic

Return a DecimalStorage::TypeXX representing the specified value in Binary Integral Decimal (BID) format. This format is compatible with the Intel DFP implementation type.

◆ convertToBID() [3/3]

DecimalStorage::Type64 bdldfp::DecimalImpUtil::convertToBID ( ValueType64  value)
inlinestatic

◆ convertToDecimal128() [1/2]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::convertToDecimal128 ( const ValueType32 input)
inlinestatic

Convert the specified input to the closest value of the indicated result type following the conversion rules as defined by IEEE-754:

◆ convertToDecimal128() [2/2]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::convertToDecimal128 ( const ValueType64 input)
inlinestatic
  • If input is signaling NaN, store the value of the macro EDOM into errno and return signaling NaN value.
  • If input is NaN, return NaN value.
  • Otherwise if input is infinity (positive or negative), then return infinity with the same sign.
  • Otherwise if input is zero (positive or negative), then return zero with the same sign.
  • Otherwise if input has an absolute value that is larger than maximum or is smaller than minimum value supported by the result type, store the value of the macro ERANGE into errno and return infinity or zero with the same sign respectively.
  • Otherwise if input has a value that is not exactly representable using maximum digit number supported by the indicated result type then return the input rounded according to the rounding direction.
  • Otherwise return input value of the result type.

◆ convertToDecimal32() [1/2]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::convertToDecimal32 ( const ValueType128 input)
inlinestatic

◆ convertToDecimal32() [2/2]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::convertToDecimal32 ( const ValueType64 input)
inlinestatic

◆ convertToDecimal64() [1/2]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::convertToDecimal64 ( const ValueType128 input)
inlinestatic

◆ convertToDecimal64() [2/2]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::convertToDecimal64 ( const ValueType32 input)
inlinestatic

◆ copySign() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::copySign ( ValueType128  x,
ValueType128  y 
)
inlinestatic

Examples: copysign( 5.0, -2.0) ==> -5.0; copysign(-5.0, -2.0) ==> -5.0

◆ copySign() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::copySign ( ValueType32  x,
ValueType32  y 
)
inlinestatic

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.

◆ copySign() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::copySign ( ValueType64  x,
ValueType64  y 
)
inlinestatic

◆ decompose() [1/3]

static int bdldfp::DecimalImpUtil::decompose ( int *  sign,
bsls::Types::Uint64 significand,
int *  exponent,
ValueType64  value 
)
static

◆ decompose() [2/3]

static int bdldfp::DecimalImpUtil::decompose ( int *  sign,
Uint128 significand,
int *  exponent,
ValueType128  value 
)
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).

◆ decompose() [3/3]

static int bdldfp::DecimalImpUtil::decompose ( int *  sign,
unsigned int *  significand,
int *  exponent,
ValueType32  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:

  • if value is NaN, return FP_NAN;
  • if value is infinity, return FP_INFINITE;
  • if value is a subnormal value, return FP_SUBNORMAL;
  • if value is a zero value, return FP_ZERO;
  • otherwise return FP_NORMAL.

◆ denormMin128()

static ValueType128 bdldfp::DecimalImpUtil::denormMin128 ( )
static

Return the smallest positive denormalized value for the ValueType128 type (IEEE-754: +0.000000000000000000000000000000001e-6143).

◆ denormMin32()

static ValueType32 bdldfp::DecimalImpUtil::denormMin32 ( )
static

Return the smallest positive denormalized value for the ValueType32 type (IEEE-754: +0.000001e-95).

◆ denormMin64()

static ValueType64 bdldfp::DecimalImpUtil::denormMin64 ( )
static

Return the smallest positive denormalized value for the ValueType64 type (IEEE-754: +0.000000000000001e-383).

◆ divide() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::divide ( DecimalImpUtil::ValueType128  lhs,
DecimalImpUtil::ValueType128  rhs 
)
inlinestatic
  • If either of lhs or rhs is signaling NaN, then store the value of the macro EDOM into errno and return a NaN.
  • Otherwise if either of lhs or rhs is NaN, return a NaN.
  • Otherwise if lhs and rhs are both infinity (positive or negative) or both zero (positive or negative) then store the value of the macro EDOM into errno and return a NaN.
  • Otherwise if lhs has a normal value and rhs has a positive zero value, store the value of the macro ERANGE into errno and return infinity with the sign of lhs.
  • Otherwise if lhs has a normal value and rhs has a negative zero value, store the value of the macro ERANGE into errno and return infinity with the opposite sign as lhs.
  • Otherwise if dividing the value of lhs by the value of rhs results in an absolute value that is larger than the maximum value supported by the result type then store the value of the macro ERANGE into errno and return infinity with the same sign as that result.
  • Otherwise if dividing the value of lhs by the value of rhs results in an absolute value that is smaller than min value supported by the indicated result type then store the value of the macro ERANGE into errnoand return zero with the same sign as that result.
  • Otherwise return the result of dividing the value of lhs by the value of rhs.

◆ divide() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::divide ( DecimalImpUtil::ValueType32  lhs,
DecimalImpUtil::ValueType32  rhs 
)
inlinestatic

Divide the value of the specified lhs by the value of the specified rhs as described by IEEE-754, and return the result.

◆ divide() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::divide ( DecimalImpUtil::ValueType64  lhs,
DecimalImpUtil::ValueType64  rhs 
)
inlinestatic

◆ epsilon128()

static ValueType128 bdldfp::DecimalImpUtil::epsilon128 ( )
static

Return the difference between the least representable value of type ValueType128 greater than 1 and 1 (IEEE-754: +1e-33).

◆ epsilon32()

static ValueType32 bdldfp::DecimalImpUtil::epsilon32 ( )
static

Return the difference between the least representable value of type ValueType32 greater than 1 and 1 (IEEE-754: +1e-6).

◆ epsilon64()

static ValueType64 bdldfp::DecimalImpUtil::epsilon64 ( )
static

Return the difference between the least representable value of type ValueType64 greater than 1 and 1 (IEEE-754: +1e-15).

◆ equal() [1/3]

bool bdldfp::DecimalImpUtil::equal ( DecimalImpUtil::ValueType128  lhs,
DecimalImpUtil::ValueType128  rhs 
)
inlinestatic

If either or both operands are signaling NaN, store the value of the macro EDOM into errno and return false.

◆ equal() [2/3]

bool bdldfp::DecimalImpUtil::equal ( DecimalImpUtil::ValueType32  lhs,
DecimalImpUtil::ValueType32  rhs 
)
inlinestatic

Return true if the specified lhs and rhs have the same value, and false otherwise. Two decimal objects have the same value if the compareQuietEqual operation (IEEE-754 defined, non-total ordering comparison) considers the underlying IEEE representations equal. In other words, two decimal objects have the same value if:

  • both have a zero value (positive or negative), or
  • both have the same infinity value (both positive or negative), or
  • both have the value of a real number that are equal, even if they are represented differently (cohorts have the same value)

◆ equal() [3/3]

bool bdldfp::DecimalImpUtil::equal ( DecimalImpUtil::ValueType64  lhs,
DecimalImpUtil::ValueType64  rhs 
)
inlinestatic

◆ exp() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::exp ( ValueType128  x)
inlinestatic

Special value handling:

  • If x is +/-0, 1 is returned.
  • If x is negative infinity, +0 is returned.
  • If x is +infinity, +infinity is returned.
  • If x is quiet NaN, quiet NaN is returned.
  • If x is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.
  • If 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.

◆ exp() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::exp ( ValueType32  x)
inlinestatic

Return e (Euler's number, 2.7182818) raised to the specified power x.

◆ exp() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::exp ( ValueType64  x)
inlinestatic

◆ fabs() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::fabs ( ValueType128  x)
inlinestatic

Special value handling:

  • if x is NaN (either signaling or quiet), quiet NaN is returned.
  • if x is +/-infinity or +/-0, it is returned unmodified.

◆ fabs() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::fabs ( ValueType32  x)
inlinestatic

Return the absolute value of the specified x.

◆ fabs() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::fabs ( ValueType64  x)
inlinestatic

◆ floor() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::floor ( ValueType128  x)
inlinestatic

◆ floor() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::floor ( ValueType32  x)
inlinestatic

Return the largest integral value that is not greater than the specified x.

Special value handling:

  • if x is quiet NaN, quiet NaN is returned.
  • If x is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.
  • if x is +/-infinity or +/-0, it is returned unmodified.

◆ floor() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::floor ( ValueType64  x)
inlinestatic

◆ fma() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::fma ( ValueType128  x,
ValueType128  y,
ValueType128  z 
)
inlinestatic

Special value handling:

  • If x or y are quiet NaN, quiet NaN is returned.
  • If any argument is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.
  • If x*y is an exact infinity and z is infinity with the opposite sign, quiet NaN is returned and the value of the macro EDOM is stored into errno.
  • If 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.
  • If 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.

◆ fma() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::fma ( ValueType32  x,
ValueType32  y,
ValueType32  z 
)
inlinestatic

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.

◆ fma() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::fma ( ValueType64  x,
ValueType64  y,
ValueType64  z 
)
inlinestatic

◆ fmod() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::fmod ( ValueType128  x,
ValueType128  y 
)
inlinestatic

Special value handling:

  • If either argument is quiet NaN, quiet NaN is returned.
  • If either argument is signaling NaN, quiet NaN is returned, and the value of the macro EDOM is stored into errno.
  • If x is +/-infnity and y is not NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.
  • If x is +/-0 and y is not zero, +/-0 is returned.
  • If y is +/-0, quite NaN is returned and the value of the macro EDOM is stored into errno.
  • If x is finite and y is +/-infnity, x is returned.

◆ fmod() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::fmod ( ValueType32  x,
ValueType32  y 
)
inlinestatic

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.

◆ fmod() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::fmod ( ValueType64  x,
ValueType64  y 
)
inlinestatic

◆ format() [1/3]

static int bdldfp::DecimalImpUtil::format ( char *  buffer,
int  length,
ValueType128  value,
const DecimalFormatConfig cfg 
)
static

Format the specified value, according to the parameters in the specified cfg. Place 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. See the Attributes section under @DESCRIPTION in the component-level documentation for bdldfp::DecimalFormatConfig component 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.

◆ format() [2/3]

static int bdldfp::DecimalImpUtil::format ( char *  buffer,
int  length,
ValueType32  value,
const DecimalFormatConfig cfg 
)
static

◆ format() [3/3]

static int bdldfp::DecimalImpUtil::format ( char *  buffer,
int  length,
ValueType64  value,
const DecimalFormatConfig cfg 
)
static

◆ greater() [1/3]

bool bdldfp::DecimalImpUtil::greater ( DecimalImpUtil::ValueType128  lhs,
DecimalImpUtil::ValueType128  rhs 
)
inlinestatic

If either or both operands are signaling NaN, store the value of the macro EDOM into errno and return false.

◆ greater() [2/3]

bool bdldfp::DecimalImpUtil::greater ( DecimalImpUtil::ValueType32  lhs,
DecimalImpUtil::ValueType32  rhs 
)
inlinestatic

Return true if the specified lhs has a greater value than the specified rhs and false otherwise. The value of a Decimal64 object lhs is greater than that of an object rhs if the compareQuietGreater operation (IEEE-754 defined, non-total ordering comparison) considers the underlying IEEE representation of lhs to be greater than of that of rhs. In other words, lhs is greater than rhs if:

  • neither lhs nor rhs are NaN, or
  • rhs is zero (positive or negative) and lhs positive, or
  • lhs is zero (positive or negative) and rhs negative, or
  • lhs is not negative infinity, or
  • lhs is positive infinity and rhs is not, or
  • lhs and rhs both represent a real number and the real number of lhs is greater than that of rhs

◆ greater() [3/3]

bool bdldfp::DecimalImpUtil::greater ( DecimalImpUtil::ValueType64  lhs,
DecimalImpUtil::ValueType64  rhs 
)
inlinestatic

◆ greaterEqual() [1/3]

bool bdldfp::DecimalImpUtil::greaterEqual ( DecimalImpUtil::ValueType128  lhs,
DecimalImpUtil::ValueType128  rhs 
)
inlinestatic

If either or both operands are signaling NaN, store the value of the macro EDOM into errno and return false.

◆ greaterEqual() [2/3]

bool bdldfp::DecimalImpUtil::greaterEqual ( DecimalImpUtil::ValueType32  lhs,
DecimalImpUtil::ValueType32  rhs 
)
inlinestatic

Return true if the specified lhs has a value greater than or equal to the value of the specified rhs and false otherwise. The value of a Decimal64 object lhs is greater or equal to a Decimal64 object rhs if the compareQuietGreaterEqual operation (IEEE-754 defined, non-total ordering comparison ) considers the underlying IEEE representation of lhs to be greater or equal to that of rhs. In other words, lhs is greater than or equal to rhs if:

  • neither lhs nor rhs are NaN, or
  • lhs and rhs are both zero (positive or negative), or
  • both lhs and rhs are negative infinity, or
  • lhs is positive infinity, or
  • lhs and rhs both represent a real number and the real number of lhs is greater or equal to that of rhs

◆ greaterEqual() [3/3]

bool bdldfp::DecimalImpUtil::greaterEqual ( DecimalImpUtil::ValueType64  lhs,
DecimalImpUtil::ValueType64  rhs 
)
inlinestatic

◆ infinity128()

static ValueType128 bdldfp::DecimalImpUtil::infinity128 ( )
static

Return the value that represents positive infinity for the ValueType128 type.

◆ infinity32()

static ValueType32 bdldfp::DecimalImpUtil::infinity32 ( )
static

Return the value that represents positive infinity for the ValueType32 type.

◆ infinity64()

static ValueType64 bdldfp::DecimalImpUtil::infinity64 ( )
static

Return the value that represents positive infinity for the ValueType64 type.

◆ int32ToDecimal128()

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::int32ToDecimal128 ( int  value)
inlinestatic

◆ int32ToDecimal32()

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::int32ToDecimal32 ( int  value)
inlinestatic

◆ int32ToDecimal64()

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::int32ToDecimal64 ( int  value)
inlinestatic

◆ int64ToDecimal128()

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::int64ToDecimal128 ( long long int  value)
inlinestatic

The exponent 0 (quantum 1e-15) is preferred during conversion unless it would cause unnecessary loss of precision.

◆ int64ToDecimal32()

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::int64ToDecimal32 ( long long int  value)
inlinestatic

◆ int64ToDecimal64()

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::int64ToDecimal64 ( long long int  value)
inlinestatic

The exponent 0 (quantum 1e-6) is preferred during conversion unless it would cause unnecessary loss of precision.

◆ less() [1/3]

bool bdldfp::DecimalImpUtil::less ( DecimalImpUtil::ValueType128  lhs,
DecimalImpUtil::ValueType128  rhs 
)
inlinestatic

If either or both operands are signaling NaN, store the value of the macro EDOM into errno and return false.

◆ less() [2/3]

bool bdldfp::DecimalImpUtil::less ( DecimalImpUtil::ValueType32  lhs,
DecimalImpUtil::ValueType32  rhs 
)
inlinestatic

Return true if the specified lhs has a value less than the specified rhs and false otherwise. The value of a Decimal64 object lhs is less than that of an object rhs if the compareQuietLess operation (IEEE-754 defined, non-total ordering comparison) considers the underlying IEEE representation of lhs to be less than of that of rhs. In other words, lhs is less than rhs if:

  • neither lhs nor rhs are NaN, or
  • lhs is zero (positive or negative) and rhs is positive, or
  • rhs is zero (positive or negative) and lhs negative, or
  • lhs is not positive infinity, or
  • lhs is negative infinity and rhs is not, or
  • lhs and rhs both represent a real number and the real number of lhs is less than that of rhs

◆ less() [3/3]

bool bdldfp::DecimalImpUtil::less ( DecimalImpUtil::ValueType64  lhs,
DecimalImpUtil::ValueType64  rhs 
)
inlinestatic

◆ lessEqual() [1/3]

bool bdldfp::DecimalImpUtil::lessEqual ( DecimalImpUtil::ValueType128  lhs,
DecimalImpUtil::ValueType128  rhs 
)
inlinestatic

If either or both operands are signaling NaN, store the value of the macro EDOM into errno and return false.

◆ lessEqual() [2/3]

bool bdldfp::DecimalImpUtil::lessEqual ( DecimalImpUtil::ValueType32  lhs,
DecimalImpUtil::ValueType32  rhs 
)
inlinestatic

Return true if the specified lhs has a value less than or equal the value of the specified rhs and false otherwise. The value of a Decimal64 object lhs is less than or equal to the value of an object rhs if the compareQuietLessEqual operation (IEEE-754 defined, non-total ordering comparison) considers the underlying IEEE representation of lhs to be less or equal to that of rhs. In other words, lhs is less or equal than rhs if:

  • neither lhs nor rhs are NaN, or
  • lhs and rhs are both zero (positive or negative), or
  • both lhs and rhs are positive infinity, or
  • lhs is negative infinity, or
  • lhs and rhs both represent a real number and the real number of lhs is less or equal to that of rhs

◆ lessEqual() [3/3]

bool bdldfp::DecimalImpUtil::lessEqual ( DecimalImpUtil::ValueType64  lhs,
DecimalImpUtil::ValueType64  rhs 
)
inlinestatic

◆ llrint() [1/3]

long long int bdldfp::DecimalImpUtil::llrint ( ValueType128  x)
inlinestatic

◆ llrint() [2/3]

long long int bdldfp::DecimalImpUtil::llrint ( ValueType32  x)
inlinestatic

◆ llrint() [3/3]

long long int bdldfp::DecimalImpUtil::llrint ( ValueType64  x)
inlinestatic

◆ log() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::log ( ValueType128  x)
inlinestatic

Special value handling:

  • If x is +/-0, -infinity is returned and the value of the macro ERANGE is stored into errno.
  • If x is 1, +0 is returned.
  • If x is negative, quiet NaN is returned and the value of the macro EDOM is stored into errno.
  • If x is +infinity, +infinity is returned.
  • If x is quiet NaN, quiet NaN is returned.
  • If x is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.

◆ log() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::log ( ValueType32  x)
inlinestatic

Return the natural (base e) logarithm of the specified x.

◆ log() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::log ( ValueType64  x)
inlinestatic

◆ log10() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::log10 ( ValueType128  x)
inlinestatic

Special value handling:

  • If x is +/-0, -infinity is returned and the value of the macro ERANGE is stored into errno.
  • If x is 1, +0 is returned.
  • If x is negative, quiet NaN is returned and the value of the macro EDOM is stored into errno.
  • If x is +infinity, +infinity is returned.
  • If x is quiet NaN, quiet NaN is returned.
  • If x is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.

◆ log10() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::log10 ( ValueType32  x)
inlinestatic

Return the common (base-10) logarithm of the specified x.

◆ log10() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::log10 ( ValueType64  x)
inlinestatic

◆ logB() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::logB ( ValueType128  x)
inlinestatic

Examples: logB( 10.0) ==> 1.0; logB(-100.0) ==> 2.0

◆ logB() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::logB ( ValueType32  x)
inlinestatic

Return the FLT_RADIX-based logarithm (i.e., base 10) of the absolute value of the specified x.

Special value handling:

  • If x is +/-0, -infinity is returned and the value of the macro ERANGE is stored into errno.
  • If x is 1, +0 is returned.
  • If x is +/-infinity, +infinity is returned.
  • If x is quiet NaN, quiet NaN is returned.
  • If x is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.

◆ logB() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::logB ( ValueType64  x)
inlinestatic

◆ lrint() [1/3]

long int bdldfp::DecimalImpUtil::lrint ( ValueType128  x)
inlinestatic

Special value handling:

  • The current rounding mode has no effect.
  • If either argument is quiet NaN, quiet NaN is returned.
  • If either argument is signaling NaN, quiet NaN is returned, and the value of the macro EDOM is stored into errno.
  • If y is +/-0, quiet NaN is returned and the value of the macro EDOM is stored into errno.
  • If x is +/-infnity and y is not NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.
  • If x is finite and y is +/-infnity, x is returned.

◆ lrint() [2/3]

long int bdldfp::DecimalImpUtil::lrint ( ValueType32  x)
inlinestatic

◆ lrint() [3/3]

long int bdldfp::DecimalImpUtil::lrint ( ValueType64  x)
inlinestatic

◆ lround() [1/3]

long int bdldfp::DecimalImpUtil::lround ( ValueType128  x)
inlinestatic

◆ lround() [2/3]

long int bdldfp::DecimalImpUtil::lround ( ValueType32  x)
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:

  • if x is NaN (either quiet or signaling), quiet NaN is returned and the value of the macro EDOM is stored into errno.
  • if x is +/-infinity, quite NaN is returned and the value of the macro EDOM is stored into errno.
  • If the result of the rounding is outside the range of the return type, the macro EDOM is stored into errno.

◆ lround() [3/3]

long int bdldfp::DecimalImpUtil::lround ( ValueType64  x)
inlinestatic

◆ makeDecimal64() [1/4]

static ValueType64 bdldfp::DecimalImpUtil::makeDecimal64 ( int  significand,
int  exponent 
)
static

◆ makeDecimal64() [2/4]

static ValueType64 bdldfp::DecimalImpUtil::makeDecimal64 ( long long int  significand,
int  exponent 
)
static

◆ makeDecimal64() [3/4]

static ValueType64 bdldfp::DecimalImpUtil::makeDecimal64 ( unsigned int  significand,
int  exponent 
)
static

◆ makeDecimal64() [4/4]

static ValueType64 bdldfp::DecimalImpUtil::makeDecimal64 ( unsigned long long int  significand,
int  exponent 
)
static

Return a Decimal64 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.

◆ makeDecimalRaw128() [1/4]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::makeDecimalRaw128 ( int  significand,
int  exponent 
)
inlinestatic

Create a ValueType128 object representing a decimal floating point number consisting of the specified significand and exponent, with the sign given by significand. The behavior is undefined unless -6176 <= exponent <= 6111.

◆ makeDecimalRaw128() [2/4]

static ValueType128 bdldfp::DecimalImpUtil::makeDecimalRaw128 ( long long int  significand,
int  exponent 
)
static

◆ makeDecimalRaw128() [3/4]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::makeDecimalRaw128 ( unsigned int  significand,
int  exponent 
)
inlinestatic

◆ makeDecimalRaw128() [4/4]

static ValueType128 bdldfp::DecimalImpUtil::makeDecimalRaw128 ( unsigned long long int  significand,
int  exponent 
)
static

◆ makeDecimalRaw32()

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::makeDecimalRaw32 ( int  significand,
int  exponent 
)
inlinestatic

Create a ValueType32 object representing a decimal floating point number consisting of the specified significand and exponent, with the sign given by significand. The behavior is undefined unless abs(significand) <= 9,999,999 and -101 <= exponent <= 90.

◆ makeDecimalRaw64() [1/4]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::makeDecimalRaw64 ( int  significand,
int  exponent 
)
inlinestatic

Create a ValueType64 object representing a decimal floating point number consisting of the specified significand and exponent, with the sign given by significand. The behavior is undefined unless abs(significand) <= 9,999,999,999,999,999 and -398 <= exponent <= 369.

◆ makeDecimalRaw64() [2/4]

static ValueType64 bdldfp::DecimalImpUtil::makeDecimalRaw64 ( long long int  significand,
int  exponent 
)
static

◆ makeDecimalRaw64() [3/4]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::makeDecimalRaw64 ( unsigned int  significand,
int  exponent 
)
inlinestatic

◆ makeDecimalRaw64() [4/4]

static ValueType64 bdldfp::DecimalImpUtil::makeDecimalRaw64 ( unsigned long long int  significand,
int  exponent 
)
static

◆ makeInfinity64()

static ValueType64 bdldfp::DecimalImpUtil::makeInfinity64 ( bool  isNegative = false)
static

Return a ValueType64 representing infinity. Optionally specify whether the infinity isNegative. If isNegative is false or is is not supplied, the returned value will be infinity, and negative infinity otherwise.

◆ max128()

static ValueType128 bdldfp::DecimalImpUtil::max128 ( )
static

Return the largest number ValueType128 can represent (IEEE-754: +9.999999999999999999999999999999999e+6144).

◆ max32()

static ValueType32 bdldfp::DecimalImpUtil::max32 ( )
static

Return the largest number ValueType32 can represent (IEEE-754: +9.999999e+96).

◆ max64()

static ValueType64 bdldfp::DecimalImpUtil::max64 ( )
static

Return the largest number ValueType64 can represent (IEEE-754: +9.999999999999999e+384).

◆ min128()

static ValueType128 bdldfp::DecimalImpUtil::min128 ( )
static

Return the smallest positive normalized number ValueType128 can represent (IEEE-754: +1e-6143).

◆ min32()

static ValueType32 bdldfp::DecimalImpUtil::min32 ( )
static

Return the smallest positive normalized number ValueType32 can represent (IEEE-754: +1e-95).

◆ min64()

static ValueType64 bdldfp::DecimalImpUtil::min64 ( )
static

Return the smallest positive normalized number ValueType64 can represent (IEEE-754: +1e-383).

◆ multiply() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::multiply ( DecimalImpUtil::ValueType128  lhs,
DecimalImpUtil::ValueType128  rhs 
)
inlinestatic
  • If either of lhs or rhs is signaling NaN, then store the value of the macro EDOM into errno and return a NaN.
  • Otherwise if either of lhs or rhs is NaN, return a NaN.
  • Otherwise if one of the operands is infinity (positive or negative) and the other is zero (positive or negative), then store the value of the macro EDOM into errno and return a NaN.
  • Otherwise if both lhs and rhs are infinity (positive or negative), return infinity. The sign of the returned value will be positive if lhs and rhs have the same sign, and negative otherwise.
  • Otherwise, if either lhs or rhs is zero, return zero. The sign of the returned value will be positive if lhs and rhs have the same sign, and negative otherwise.
  • Otherwise if the product of lhs and rhs has an absolute value that is larger than the maximum value of the indicated result type then store the value of the macro ERANGE into errno and return infinity with the same sign as that result.
  • Otherwise if the product of lhs and rhs has an absolute value that is smaller than min value of the indicated result type then store the value of the macro ERANGE into errno and return zero with the same sign as that result.
  • Otherwise return the product of the value of rhs and the number represented by rhs.

◆ multiply() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::multiply ( DecimalImpUtil::ValueType32  lhs,
DecimalImpUtil::ValueType32  rhs 
)
inlinestatic

Multiply the value of the specified lhs object by the value of the specified rhs as described by IEEE-754 and return the result.

◆ multiply() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::multiply ( DecimalImpUtil::ValueType64  lhs,
DecimalImpUtil::ValueType64  rhs 
)
inlinestatic

◆ negate() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::negate ( DecimalImpUtil::ValueType128  value)
inlinestatic

Return the result of applying the unary negation (-) operator to the specified value as described by IEEE-754. Note that decimal floating point representations can encode signed zero values, thus negating 0 results in -0 and negating -0 results in 0.

◆ negate() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::negate ( DecimalImpUtil::ValueType32  value)
inlinestatic

◆ negate() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::negate ( DecimalImpUtil::ValueType64  value)
inlinestatic

◆ nextafter() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::nextafter ( ValueType128  from,
ValueType128  to 
)
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.

◆ nextafter() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::nextafter ( ValueType32  from,
ValueType32  to 
)
inlinestatic

◆ nextafter() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::nextafter ( ValueType64  from,
ValueType64  to 
)
inlinestatic

◆ nexttoward() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::nexttoward ( ValueType128  from,
ValueType128  to 
)
inlinestatic

Special value handling:

  • If from equals to, to is returned.
  • If either argument is quiet NaN, quiet NaN is returned.
  • If either argument is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.
  • If from is finite, but the expected result is infinity, infinity is returned and the value of the macro ERANGE is stored into errno.
  • If from does not equal to and the result is subnormal or zero, the value of the macro ERANGE is stored into errno.

◆ nexttoward() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::nexttoward ( ValueType32  from,
ValueType128  to 
)
inlinestatic

Return the next representable value of the specified from in the direction of the specified to.

◆ nexttoward() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::nexttoward ( ValueType64  from,
ValueType128  to 
)
inlinestatic

◆ normalize() [1/3]

static ValueType128 bdldfp::DecimalImpUtil::normalize ( ValueType128  original)
static
  • Any representations of zero value (either positive or negative) are normalized to positive zero having null significand and exponent.
  • Any NaN values (either signaling or quiet) are normalized to quiet NaN.
  • Normalized non-zero value has the same sign as the original one.

◆ normalize() [2/3]

static ValueType32 bdldfp::DecimalImpUtil::normalize ( ValueType32  original)
static

Return a ValueTypeXX number having the value as the specified 'original, but with the significand, that can not be divided by ten, and appropriate exponent.

◆ normalize() [3/3]

static ValueType64 bdldfp::DecimalImpUtil::normalize ( ValueType64  original)
static

◆ notEqual() [1/3]

bool bdldfp::DecimalImpUtil::notEqual ( DecimalImpUtil::ValueType128  lhs,
DecimalImpUtil::ValueType128  rhs 
)
inlinestatic

If either or both operands are signaling NaN, store the value of the macro EDOM into errno and return false.

◆ notEqual() [2/3]

bool bdldfp::DecimalImpUtil::notEqual ( DecimalImpUtil::ValueType32  lhs,
DecimalImpUtil::ValueType32  rhs 
)
inlinestatic

Return false if the specified lhs and rhs have the same value, and true otherwise. Two decimal objects have the same value if the compareQuietEqual operation (IEEE-754 defined, non-total ordering comparison) considers the underlying IEEE representations equal. In other words, two decimal objects have the same value if:

  • both have a zero value (positive or negative), or
  • both have the same infinity value (both positive or negative), or
  • both have the value of a real number that are equal, even if they are represented differently (cohorts have the same value)

◆ notEqual() [3/3]

bool bdldfp::DecimalImpUtil::notEqual ( DecimalImpUtil::ValueType64  lhs,
DecimalImpUtil::ValueType64  rhs 
)
inlinestatic

◆ parse128() [1/2]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::parse128 ( const char *  input)
inlinestatic

◆ parse128() [2/2]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::parse128 ( const char *  input,
unsigned int *  status 
)
inlinestatic

Produce an object of the indicated return type by parsing the specified input string that represents a floating-point number (written in either fixed or scientific notation). Optionally specify status in which to load a bit mask of additional status information. The resulting decimal object is initialized as follows:

  • If input does not represent a floating-point value, then return a decimal object of the indicated return type initialized to a NaN.
  • Otherwise if input represents infinity (positive or negative), as case-insensitive "Inf" or "Infinity" string, then return a decimal object of the indicated return type initialized to infinity value with the same sign.
  • Otherwise if input represents zero (positive or negative), then return a decimal object of the indicated return type initialized to zero with the same sign.
  • Otherwise if str represents a value that has an absolute value that is larger than std::numeric_limits<Decimal32>::max() then store the value of the macro ERANGE into errno and return a decimal object of the indicated return type initialized to infinity with the same sign.
  • Otherwise if input represents a value that has an absolute value that is smaller than std::numeric_limits<Decimal32>::min(), then store the value of the macro ERANGE into errno and return a decimal object of the indicated return type initialized to zero with the same sign.
  • Otherwise if input has a value that is not exactly representable using std::numeric_limits<Decimal32>::max_digit decimal digits then return a decimal object of the indicated return type initialized to the value represented by input rounded according to the rounding direction.
  • Otherwise return a decimal object of the indicated return type initialized to the decimal value representation of input.

The *status, if supplied, mest be 0, and may be loaded with a bit mask of k_STATUS_INEXACT, k_STATUS_UNDERFLOW, and k_STATUS_OVERFLOW indicating wether the conversion from text was inexact, underflowed, or overflowed (or some combination) respectively. The behavior is undefined unless *status (if supplied) is 0.

Note that the parsing follows the rules as specified for the strtod32 function in section 9.6 of the ISO/EIC TR 24732 C Decimal Floating-Point Technical Report.

Also note that the quanta of the resultant value is determined by the number of decimal places starting with the most significand digit in input string and cannot exceed the maximum number of digits necessary to differentiate all values of the indicated return type, for example:

'parse32("0.015") => 15e-3'
'parse32("1.5") => 15e-1'
'parse32("1.500") => 1500e-3'
'parse32("1.2345678) => 1234568e-6'

◆ parse32() [1/2]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::parse32 ( const char *  input)
inlinestatic

◆ parse32() [2/2]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::parse32 ( const char *  input,
unsigned int *  status 
)
inlinestatic

◆ parse64() [1/2]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::parse64 ( const char *  input)
inlinestatic

◆ parse64() [2/2]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::parse64 ( const char *  input,
unsigned int *  status 
)
inlinestatic

◆ pow() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::pow ( ValueType128  base,
ValueType128  exp 
)
inlinestatic

Special value handling:

  • If 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.
  • If the mathematical result of this function is infinity or undefined or a range error due to overflow occurs, infinity is returned and the value of the macro ERANGE is stored into errno.
  • If a range error occurs due to underflow, the correct result (after rounding) is returned and the value of the macro ERANGE is stored into errno.
  • If either argument is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.

◆ pow() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::pow ( ValueType32  base,
ValueType32  exp 
)
inlinestatic

Return the value of the specified base raised to the power of the specified exp.

◆ pow() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::pow ( ValueType64  base,
ValueType64  exp 
)
inlinestatic

◆ quantize() [1/6]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::quantize ( ValueType128  value,
int  exponent 
)
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

  • for Decimal32 type: -101 <= exponent <= 90
  • for Decimal64 type: -398 <= exponent <= 369
  • for Decimal128 type: -6176 <= exponent <= 6111

◆ quantize() [2/6]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::quantize ( ValueType128  value,
ValueType128  exponent 
)
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.

◆ quantize() [3/6]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::quantize ( ValueType32  value,
int  exponent 
)
inlinestatic

◆ quantize() [4/6]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::quantize ( ValueType32  value,
ValueType32  exponent 
)
inlinestatic

◆ quantize() [5/6]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::quantize ( ValueType64  value,
int  exponent 
)
inlinestatic

◆ quantize() [6/6]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::quantize ( ValueType64  value,
ValueType64  exponent 
)
inlinestatic

◆ quantizeEqual() [1/3]

int bdldfp::DecimalImpUtil::quantizeEqual ( ValueType128 x,
ValueType128  y,
int  exponent 
)
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);

◆ quantizeEqual() [2/3]

int bdldfp::DecimalImpUtil::quantizeEqual ( ValueType32 x,
ValueType32  y,
int  exponent 
)
inlinestatic

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

  • for Decimal32 type: -101 <= exponent <= 90
  • for Decimal64 type: -398 <= exponent <= 369
  • for Decimal128 type: -6176 <= exponent <= 6111

◆ quantizeEqual() [3/3]

int bdldfp::DecimalImpUtil::quantizeEqual ( ValueType64 x,
ValueType64  y,
int  exponent 
)
inlinestatic

◆ quietNaN128()

static ValueType128 bdldfp::DecimalImpUtil::quietNaN128 ( )
static

Return a value that represents non-signaling NaN for the ValueType128 type.

◆ quietNaN32()

static ValueType32 bdldfp::DecimalImpUtil::quietNaN32 ( )
static

Return a value that represents non-signaling NaN for the ValueType32 type.

◆ quietNaN64()

static ValueType64 bdldfp::DecimalImpUtil::quietNaN64 ( )
static

Return a value that represents non-signaling NaN for the ValueType64 type.

◆ remainder() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::remainder ( ValueType128  x,
ValueType128  y 
)
inlinestatic

◆ remainder() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::remainder ( ValueType32  x,
ValueType32  y 
)
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.

◆ remainder() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::remainder ( ValueType64  x,
ValueType64  y 
)
inlinestatic

◆ round() [1/6]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::round ( ValueType128  x)
inlinestatic

◆ round() [2/6]

static ValueType128 bdldfp::DecimalImpUtil::round ( ValueType128  x,
unsigned int  precision 
)
static

◆ round() [3/6]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::round ( ValueType32  x)
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:

  • if x is quiet NaN, quiet NaN is returned.
  • If x is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.
  • if x is +/-infinity or +/-0, it is returned unmodified.

◆ round() [4/6]

static ValueType32 bdldfp::DecimalImpUtil::round ( ValueType32  x,
unsigned int  precision 
)
static

Return the specified x value rounded to the specified precision. 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.

◆ round() [5/6]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::round ( ValueType64  x)
inlinestatic

◆ round() [6/6]

static ValueType64 bdldfp::DecimalImpUtil::round ( ValueType64  x,
unsigned int  precision 
)
static

◆ roundError128()

static ValueType128 bdldfp::DecimalImpUtil::roundError128 ( )
static

Return the maximum rounding error for the ValueType128 type. The actual value returned depends on the current decimal floating point rounding setting.

◆ roundError32()

static ValueType32 bdldfp::DecimalImpUtil::roundError32 ( )
static

Return the maximum rounding error for the ValueType32 type. The actual value returned depends on the current decimal floating point rounding setting.

◆ roundError64()

static ValueType64 bdldfp::DecimalImpUtil::roundError64 ( )
static

Return the maximum rounding error for the ValueType64 type. The actual value returned depends on the current decimal floating point rounding setting.

◆ sameQuantum() [1/3]

bool bdldfp::DecimalImpUtil::sameQuantum ( ValueType128  x,
ValueType128  y 
)
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.

◆ sameQuantum() [2/3]

bool bdldfp::DecimalImpUtil::sameQuantum ( ValueType32  x,
ValueType32  y 
)
inlinestatic

◆ sameQuantum() [3/3]

bool bdldfp::DecimalImpUtil::sameQuantum ( ValueType64  x,
ValueType64  y 
)
inlinestatic

◆ scaleB() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::scaleB ( DecimalImpUtil::ValueType128  value,
int  exponent 
)
inlinestatic

Special value handling:

  • If value is quiet NaN, quiet NaN is returned.
  • If value is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.
  • If x is infinite, then infinity is returned.
  • If a range error due to overflow occurs, infinity is returned and : the value of the macro ERANGE is stored into errno.

◆ scaleB() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::scaleB ( DecimalImpUtil::ValueType32  value,
int  exponent 
)
inlinestatic

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.

◆ scaleB() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::scaleB ( DecimalImpUtil::ValueType64  value,
int  exponent 
)
inlinestatic

◆ signalingNaN128()

static ValueType128 bdldfp::DecimalImpUtil::signalingNaN128 ( )
static

Return a value that represents signaling NaN for the ValueType128 type.

◆ signalingNaN32()

static ValueType32 bdldfp::DecimalImpUtil::signalingNaN32 ( )
static

Return a value that represents signaling NaN for the ValueType32 type.

◆ signalingNaN64()

static ValueType64 bdldfp::DecimalImpUtil::signalingNaN64 ( )
static

Return a value that represents signaling NaN for the ValueType64 type.

◆ sqrt() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::sqrt ( ValueType128  x)
inlinestatic

Special value handling:

  • If x is quiet NaN, quiet NaN is returned.
  • If x is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.
  • If x is less than -0, quiet NaN is returned and the value of the macro EDOM is stored into errno.
  • If x is +/-infinity or +/-0, it is returned unmodified.

◆ sqrt() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::sqrt ( ValueType32  x)
inlinestatic

Return the square root of the specified x.

◆ sqrt() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::sqrt ( ValueType64  x)
inlinestatic

◆ subtract() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::subtract ( DecimalImpUtil::ValueType128  lhs,
DecimalImpUtil::ValueType128  rhs 
)
inlinestatic
  • If either of lhs or rhs is signaling NaN, then store the value of the macro EDOM into errno and return a NaN.
  • Otherwise if either of lhs or rhs is NaN, return a NaN.
  • Otherwise if lhs and the rhs have infinity values of the same sign, store the value of the macro EDOM into errno and return a NaN.
  • Otherwise if lhs and the rhs have infinity values of differing signs, then return lhs.
  • Otherwise if rhs has a zero value (positive or negative), then return lhs.
  • Otherwise if the subtracting of lhs and rhs has an absolute value that is larger than the maximum value supported by the indicated result type then store the value of the macro ERANGE into errno and return infinity with the same sign as that result.
  • Otherwise return the result of subtracting the value of rhs from the value of lhs.

◆ subtract() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::subtract ( DecimalImpUtil::ValueType32  lhs,
DecimalImpUtil::ValueType32  rhs 
)
inlinestatic

Subtract the value of the specified rhs from the value of the specified lhs as described by IEEE-754 and return the result.

◆ subtract() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::subtract ( DecimalImpUtil::ValueType64  lhs,
DecimalImpUtil::ValueType64  rhs 
)
inlinestatic

◆ trunc() [1/3]

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::trunc ( ValueType128  x)
inlinestatic

◆ trunc() [2/3]

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::trunc ( ValueType32  x)
inlinestatic

Return the nearest integral value that is not greater in absolute value than the specified x.

Special value handling:

  • if x is quiet NaN, quiet NaN is returned.
  • If x is signaling NaN, quiet NaN is returned and the value of the macro EDOM is stored into errno.
  • if x is +/-infinity or +/-0, it is returned unmodified.

◆ trunc() [3/3]

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::trunc ( ValueType64  x)
inlinestatic

◆ uint32ToDecimal128()

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::uint32ToDecimal128 ( unsigned int  value)
inlinestatic

◆ uint32ToDecimal32()

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::uint32ToDecimal32 ( unsigned int  value)
inlinestatic

◆ uint32ToDecimal64()

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::uint32ToDecimal64 ( unsigned int  value)
inlinestatic

◆ uint64ToDecimal128()

DecimalImpUtil::ValueType128 bdldfp::DecimalImpUtil::uint64ToDecimal128 ( unsigned long long int  value)
inlinestatic

Return a Decimal128 object having the value closest to the specified value subject to the conversion rules as defined by IEEE-754:

  • If value is zero then initialize this object to a zero with an unspecified sign and an unspecified exponent.
  • Otherwise if value has a value that is not exactly representable using std::numeric_limits<Decimal128>::max_digit decimal digits then return a decimal value initialized to the value of value rounded according to the rounding direction.
  • Otherwise initialize this object to value.

The exponent 0 (quantum 1e-33) is preferred during conversion unless it would cause unnecessary loss of precision.

◆ uint64ToDecimal32()

DecimalImpUtil::ValueType32 bdldfp::DecimalImpUtil::uint64ToDecimal32 ( unsigned long long int  value)
inlinestatic

Return a Decimal32 object having the value closest to the specified value following the conversion rules as defined by IEEE-754:

  • If value is zero then initialize this object to a zero with an unspecified sign and an unspecified exponent.
  • Otherwise if value has a value that is not exactly representable using std::numeric_limits<Decimal32>::max_digit decimal digits then return a decimal value initialized to the value of value rounded according to the rounding direction.
  • Otherwise initialize this object to the value of the value.

◆ uint64ToDecimal64()

DecimalImpUtil::ValueType64 bdldfp::DecimalImpUtil::uint64ToDecimal64 ( unsigned long long int  value)
inlinestatic

Return a Decimal64 object having the value closest to the specified value following the conversion rules as defined by IEEE-754:

  • If value is zero then initialize this object to a zero with an unspecified sign and an unspecified exponent.
  • Otherwise if value has a value that is not exactly representable using std::numeric_limits<Decimal64>::max_digit decimal digits then return a decimal value initialized to the value of value rounded according to the rounding direction.
  • Otherwise initialize this object to the value of the value.

The documentation for this class was generated from the following file: