Home | History | Annotate | Download | only in i18n

Lines Matching full:residue

146 /*    residue (in the range -1 through 9).  This avoids any double-   */
512 Int residue; /* rounding residue */
704 residue=0;
705 decSetCoeff(dn, set, res, d, &residue, &status);
707 decFinalize(dn, set, &residue, &status);
713 residue=0;
714 decFinalize(dn, set, &residue, &status);
1444 Int residue=0; /* (no residue) */
1449 decCopyFit(w, rhs, &aset, &residue, &copystat); /* copy & shorten */
1457 residue=0;
1458 decCopyFit(res, w, set, &residue, &status); /* copy & round */
1459 decFinish(res, set, &residue, &status); /* cleanup/set flags */
1967 Int residue=0; /* rounding residue */
2240 decFinalize(dac, set, &residue, &status);
2255 decCopyFit(res, dac, set, &residue, &status);
2256 decFinish(res, set, &residue, &status); /* final cleanup */
2324 Int residue=0; /* as usual */
2351 decCopyFit(res, rhs, set, &residue, &status); /* copy & round */
2352 decFinish(res, set, &residue, &status); /* cleanup/set flags */
2621 Int residue; /* work */
2644 residue=0;
2645 decFinalize(res, set, &residue, &status); /* .. and check */
2809 Int residue=0; /* rounding residue */
2875 decFinish(res, set, &residue, &status);
2995 residue=0; /* .. and accumulator */
2996 decCopyFit(a, a, &approxset, &residue, &rstatus); /* reduce (if needed) */
2997 decFinish(a, &approxset, &residue, &rstatus); /* clean and finalize */
3813 Int residue; /* rounding accumulator */
3875 residue=0; /* clear accumulator */
3876 decCopyFit(res, rhs, set, &residue, status); /* copy (as needed) */
3904 decFinish(res, set, &residue, status); /* clean and finalize */
3911 residue=0; /* clear accumulator */
3912 decCopyFit(res, lhs, set, &residue, status); /* copy (as needed) */
3930 decFinish(res, set, &residue, status); /* clean and finalize */
3979 /* affected by the residue). */
3999 /* more then lhs cannot affect the answer, except as a residue, */
4003 /* for residue use the relative sign indication... */
4005 residue=1; /* residue for rounding */
4006 if (diffsign) residue=-residue; /* signs differ */
4008 decCopyFit(res, rhs, set, &residue, status);
4016 decFinish(res, set, &residue, status); /* done */
4076 /* fit, so can't need rounding and residue must be 0.) */
4077 residue=0; /* clear accumulator */
4086 decSetCoeff(res, set, acc, res->digits, &residue, status);
4108 decSetCoeff(res, set, acc, res->digits, &residue, status);
4111 if (residue!=0) {
4112 decApplyRound(res, set, residue, status);
4113 residue=0; /* did what needed to be done */
4123 decFinish(res, set, &residue, status);
4181 /* Do until (have=digits+1 OR residue=0) */
4182 /* if exp<0 then if integer divide/residue then leave */
4248 Int residue; /* for rounding */
4304 residue=0;
4307 decCopyFit(res, lhs, set, &residue, status);
4319 decFinish(res, set, &residue, status);
4347 residue=0;
4352 decFinalize(res, set, &residue, status); /* check exponent */
4391 residue=0;
4392 decCopyFit(res, lhs, set, &residue, status);
4393 decFinish(res, set, &residue, status);
4478 /* do this now than to reassemble the residue afterwards, if */
4532 /* would increase digit by one, and the residue will be 0 so */
4533 /* the calculation is done; leave the loop with residue=0. */
4585 /* if the residue is zero, the operation is done (unless divide */
4587 if (*var1==0 && var1units==1) { /* residue is 0 */
4605 /* var1 has any residue at the stopping point */
4615 residue=0; /* assume no residue */
4617 /* record the presence of any residue, for rounding */
4618 if (*var1!=0 || var1units>1) residue=1;
4619 else { /* no residue */
4665 /* Fastpath when residue is truly 0 is worthwhile [and */
4667 if (*var1==0 && var1units==1) { /* residue is 0 */
4676 decFinish(res, set, &residue, status); /* might clamp */
4684 /* treat the residue, in var1, as the value to return, via acc */
4781 decSetCoeff(res, set, accnext, accdigits, &residue, status);
4783 decFinish(res, set, &residue, status); /* final cleanup */
4842 Int residue=0; /* rounding residue */
5116 /* it, noting if any residue */
5131 /* Set the coefficient. If any rounding, residue records */
5132 decSetCoeff(res, set, acc, res->digits, &residue, status);
5133 decFinish(res, set, &residue, status); /* final cleanup */
5232 Int residue; /* rounding residue */
5485 residue
5486 if (ISZERO(a)) residue=0; /* .. unless underflowed to 0 */
5488 decCopyFit(res, a, &aset, &residue, status); /* copy & shorten */
5489 decFinish(res, set, &residue, status); /* cleanup/set flags */
5591 Int residue; /* rounding residue */
5705 residue=0; /* (no residue) */
5707 decCopyFit(b, rhs, &aset, &residue, &ignore); /* copy & shorten */
5796 residue=1; /* indicate dirt to right */
5797 if (ISZERO(a)) residue=0; /* .. unless underflowed to 0 */
5799 decCopyFit(res, a, &aset, &residue, status); /* copy & shorten */
5800 decFinish(res, set, &residue, status); /* cleanup/set flags */
5841 Int residue=0; /* rounding residue */
5922 decCopyFit(res, lhs, &workset, &residue, status); /* fit to result */
5923 decApplyRound(res, &workset, residue, status); /* .. and round */
5924 residue=0; /* [used] */
5962 decFinalize(res, set, &residue, status); /* set subnormal flags */
6113 Int residue=0; /* rounding accumulator */
6146 decCopyFit(res, choice, set, &residue, status);
6147 decFinish(res, set, &residue, status);
6811 Int residue=0; /* rounding accumulator */
6821 decCopyFit(res, dn, set, &residue, &newstatus);
6822 decApplyRound(res, set, residue, &newstatus);
6837 /* residue is the residue accumulator */
6844 decContext *set, Int *residue, uInt *status) {
6847 decSetCoeff(dest, set, src->lsu, src->digits, residue, status);
6858 /* residue is the residue accumulator. This has values as in */
6861 /* coefficient is truncated and the residue is updated to */
6862 /* reflect the previous residue and the dropped digits. */
6883 /* incoming residue was non-0 (implies rounded) */
6885 /* mapping array: maps 0-9 to canonical residues, so that a residue */
6890 Int len, Int *residue, uInt *status) {
6910 /* dn->exponent and residue are unchanged, record any inexactitude */
6911 if (*residue!=0) *status|=(DEC_Inexact | DEC_Rounded);
6918 if (*residue>1) *residue=1; /* previous residue now to right, so reduce */
6922 /* residue is all the number [NB could be all 0s] */
6923 if (*residue<=0) { /* not already positive */
6926 *residue=1;
6930 if (*residue!=0) *status|=DEC_Inexact; /* record inexactitude */
6939 /* spin up the number, noting residue during the spin, until get to */
6946 if (*up!=0) *residue=1;
6953 /* set residue directly */
6955 if (*up>half) *residue=7;
6956 else *residue+=5; /* add sticky bit */
6959 if (*up!=0) *residue=3; /* [else is 0, leave as sticky bit] */
6987 if (rem!=0) *residue=1;
6999 /* here, discard1 is the guard digit, and residue is everything */
7000 /* else [use mapping array to accumulate residue safely] */
7001 *residue+=resmap[discard1];
7034 if (*residue!=0) *status|=DEC_Inexact; /* record inexactitude */
7043 /* residue indicates pending rounding, being any accumulated */
7070 static void decApplyRound(decNumber *dn, decContext *set, Int residue,
7075 if (residue==0) return; /* nothing to apply */
7083 /* positive residue and the lsd of dn is 0 or 5, in which case */
7084 /* it is bumped; when residue is <0, the number is therefore */
7088 if (residue<0 && lsd5!=1) bump=-1;
7089 else if (residue>0 && lsd5==0) bump=1;
7094 /* no change, except if negative residue */
7095 if (residue<0) bump=-1;
7099 if (residue>5) bump=1;
7103 if (residue>5) bump=1; /* >0.5 goes up */
7104 else if (residue==5) { /* exactly 0.5000... */
7111 if (residue>=5) bump=1;
7115 if (residue>0) bump=1;
7120 /* [negative residue cannot occur on 0] */
7122 if (residue<0) bump=-1;
7125 if (residue>0) bump=1;
7131 /* [negative residue cannot occur on 0] */
7133 if (residue<0) bump=-1;
7136 if (residue>0) bump=1;
7228 /* residue is the rounding accumulator (as in decApplyRound) */
7239 static void decFinish(decNumber *dn, decContext *set, Int *residue,
7256 decFinalize(dn, set, residue, status);
7265 /* residue is the rounding accumulator (as in decApplyRound) */
7274 static void decFinalize(decNumber *dn, decContext *set, Int *residue,
7288 /* A very nasty case here is dn == Nmin and residue<0 */
7291 decSetSubnormal(dn, set, residue, status);
7294 /* Equals case: only subnormal if dn=Nmin and negative residue */
7303 if (*residue<0 && comp==0) { /* neg residue and dn==Nmin */
7304 decApplyRound(dn, set, *residue, status); /* might force down */
7305 decSetSubnormal(dn, set, residue, status);
7311 if (*residue!=0) decApplyRound(dn, set, *residue, status);
7417 /* residue is any pending residue */
7428 static void decSetSubnormal(decNumber *dn, decContext *set, Int *residue,
7448 /* residue can never be non-zero here */
7450 if (*residue!=0) {
7451 printf("++ Subnormal 0 residue %ld\n", (LI)*residue);
7465 /* residue can never be non-zero here, except in the Nmin-residue */
7478 decSetCoeff(dn, &workset, dn->lsu, dn->digits, residue, status);
7479 decApplyRound(dn, &workset, *residue, status);