MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / decFinish

Function decFinish

extern/decNumber/decNumber.c:7237–7255  ·  view source on GitHub ↗

------------------------------------------------------------------ */ decFinish -- finish processing a number */ / dn is the number */ set is the context */ residue is the rounding accumulator (as in decApplyRound) */ status is the accumulator

Source from the content-addressed store, hash-verified

7235/* All fields are updated as required. */
7236/* ------------------------------------------------------------------ */
7237static void decFinish(decNumber *dn, decContext *set, Int *residue,
7238 uInt *status) {
7239 if (!set->extended) {
7240 if ISZERO(dn) { // value is zero
7241 dn->exponent=0; // clean exponent ..
7242 dn->bits=0; // .. and sign
7243 return; // no error possible
7244 }
7245 if (dn->exponent>=0) { // non-negative exponent
7246 // >0; reduce to integer if possible
7247 if (set->digits >= (dn->exponent+dn->digits)) {
7248 dn->digits=decShiftToMost(dn->lsu, dn->digits, dn->exponent);
7249 dn->exponent=0;
7250 }
7251 }
7252 } // !extended
7253
7254 decFinalize(dn, set, residue, status);
7255 } // decFinish
7256#endif
7257
7258/* ------------------------------------------------------------------ */

Callers 4

decNumberLog10Function · 0.85
decNumber.cFile · 0.85
decExpOpFunction · 0.85
decCompareOpFunction · 0.85

Calls 2

decShiftToMostFunction · 0.85
decFinalizeFunction · 0.70

Tested by

no test coverage detected