------------------------------------------------------------------ */ 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
| 7235 | /* All fields are updated as required. */ |
| 7236 | /* ------------------------------------------------------------------ */ |
| 7237 | static 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 | /* ------------------------------------------------------------------ */ |
no test coverage detected