void DigitList::clear() { uprv_decNumberZero(fDecNumber); uprv_decContextSetRounding(&fContext, DEC_ROUND_HALF_EVEN); internalSetDouble(0.0); }
void DigitList::clear() { uprv_decNumberZero(fDecNumber); uprv_decContextSetRounding(&fContext, DEC_ROUND_HALF_EVEN); fDouble = 0.0; fHaveDouble = TRUE; }
DigitList::DigitList() { uprv_decContextDefault(&fContext, DEC_INIT_BASE); fContext.traps = 0; uprv_decContextSetRounding(&fContext, DEC_ROUND_HALF_EVEN); fContext.digits = fStorage.getCapacity(); fDecNumber = fStorage.getAlias(); uprv_decNumberZero(fDecNumber); fDouble = 0.0; fHaveDouble = TRUE; }
void DigitList::roundFixedPoint(int32_t maximumFractionDigits) { reduce(); // Remove trailing zeros. if (fDecNumber->exponent >= -maximumFractionDigits) { return; } decNumber scale; // Dummy decimal number, but with the desired number of uprv_decNumberZero(&scale); // fraction digits. scale.exponent = -maximumFractionDigits; scale.lsu[0] = 1; uprv_decNumberQuantize(fDecNumber, fDecNumber, &scale, &fContext); reduce(); internalClear(); }
U_NAMESPACE_BEGIN // ------------------------------------- // default constructor DigitList::DigitList() { uprv_decContextDefault(&fContext, DEC_INIT_BASE); fContext.traps = 0; uprv_decContextSetRounding(&fContext, DEC_ROUND_HALF_EVEN); fContext.digits = fStorage.getCapacity(); fDecNumber = fStorage.getAlias(); uprv_decNumberZero(fDecNumber); internalSetDouble(0.0); }
U_NAMESPACE_BEGIN // ------------------------------------- // default constructor DigitList::DigitList() { uprv_decContextDefault(&fContext, DEC_INIT_BASE); fContext.traps = 0; uprv_decContextSetRounding(&fContext, DEC_ROUND_HALF_EVEN); fContext.digits = fStorage.getCapacity() - sizeof(decNumber); fDecNumber = (decNumber *)(fStorage.getAlias()); uprv_decNumberZero(fDecNumber); fDouble = 0.0; fHaveDouble = TRUE; }