Home | History | Annotate | Download | only in i18n

Lines Matching full:carry

1067   /* If not violated then carry out the operation.  */
1285 /* then carry out the operation. */
1427 /* then carry out the operation. */
2180 else { /* carry on with integer */
3021 /* Carry out the Hull correction */
3801 /* -- a carry to digits+1 digits looks possible */
3954 /* is all in one unit, no operand rounding is needed, and no carry, */
4047 /* If destructive overlap, or the number is too long, or a carry or */
4053 /* needed, +1 Unit for carry or borrow */
4838 /* chunks, and also uses a lazy carry strategy to minimise expensive */
4873 #define FASTLAZY 18 /* carry resolution point [1->18] */
4877 #define FASTLAZY 1844 /* carry resolution point [1->1844] */
4881 /* lazy carry evaluation */
4897 Int lazy; /* lazy carry counter */
4898 uLong lcarry; /* uLong carry */
4899 uInt carry; /* carry (NB not uLong) */
5030 /* a uLong without overflowing, so intermediate carry */
5032 /* short numbers usually only the one final carry resolution */
5037 lazy=FASTLAZY; /* carry delay count */
5054 if (lcarry<FASTBASE) carry=(uInt)lcarry; /* [usual] */
5055 else { /* two-place carry [fairly rare] */
5059 carry=(uInt)(lcarry-((uLong)FASTBASE*carry2)); /* [inline] */
5061 *(lp+1)+=carry; /* add to item above [inline] */
5062 *lp-=((uLong)FASTBASE*carry); /* [inline] */
5063 } /* carry resolution */
5495 a=t; /* and carry on using t instead of a */
6324 /* shift), or one Unit longer than that (if a Unit carry occurred). */
6346 /* safe, allowing space if necessary for a one-Unit carry. */
6365 eInt carry=0; /* carry integer (could be Long) */
6399 /* Carry handling is the same (i.e., duplicated) in each case. */
6401 carry+=*a;
6403 carry+=((eInt)*b)*m; /* [special-casing m=1/-1 */
6405 /* here carry is new Unit of digits; it could be +ve or -ve */
6406 if ((ueInt)carry<=DECDPUNMAX) { /* fastpath 0-DECDPUNMAX */
6407 *c=(Unit)carry;
6408 carry=0;
6412 if (carry>=0) {
6413 est=(((ueInt)carry>>11)*53687)>>18;
6414 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6415 carry=est; /* likely quotient [89%] */
6417 carry++;
6422 carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
6423 est=(((ueInt)carry>>11)*53687)>>18;
6424 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6425 carry=est-(DECDPUNMAX+1); /* correctly negative */
6427 carry++;
6430 if (carry>=0) {
6431 est=(((ueInt)carry>>3)*16777)>>21;
6432 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6433 carry=est; /* likely quotient [99%] */
6435 carry++;
6440 carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
6441 est=(((ueInt)carry>>3)*16777)>>21;
6442 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6443 carry=est-(DECDPUNMAX+1); /* correctly negative */
6445 carry++;
6448 /* Can use QUOT10 as carry <= 4 digits */
6449 if (carry>=0) {
6450 est=QUOT10(carry, DECDPUN);
6451 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6452 carry=est; /* quotient */
6456 carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
6457 est=QUOT10(carry, DECDPUN);
6458 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6459 carry=est-(DECDPUNMAX+1); /* correctly negative */
6462 if ((ueInt)carry<(DECDPUNMAX+1)*2) { /* fastpath carry +1 */
6463 *c=(Unit)(carry-(DECDPUNMAX+1)); /* [helps additions] */
6464 carry=1;
6467 if (carry>=0) {
6468 *c=(Unit)(carry%(DECDPUNMAX+1));
6469 carry=carry/(DECDPUNMAX+1);
6473 carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
6474 *c=(Unit)(carry%(DECDPUNMAX+1));
6475 carry=carry/(DECDPUNMAX+1)-(DECDPUNMAX+1);
6483 carry+=*a;
6487 carry+=((eInt)*b)*m;
6490 /* here carry is new Unit of digits; it could be +ve or -ve and */
6492 if ((ueInt)carry<=DECDPUNMAX) { /* fastpath 0-DECDPUNMAX */
6493 *c=(Unit)carry;
6494 carry=0;
6499 if (carry>=0) {
6500 est=(((ueInt)carry>>11)*53687)>>18;
6501 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6502 carry=est; /* likely quotient [79.7%] */
6504 carry++;
6509 carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
6510 est=(((ueInt)carry>>11)*53687)>>18;
6511 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6512 carry=est-(DECDPUNMAX+1); /* correctly negative */
6514 carry++;
6517 if (carry>=0) {
6518 est=(((ueInt)carry>>3)*16777)>>21;
6519 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6520 carry=est; /* likely quotient [99%] */
6522 carry++;
6527 carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
6528 est=(((ueInt)carry>>3)*16777)>>21;
6529 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6530 carry=est-(DECDPUNMAX+1); /* correctly negative */
6532 carry++;
6535 if (carry>=0) {
6536 est=QUOT10(carry, DECDPUN);
6537 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6538 carry=est; /* quotient */
6542 carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
6543 est=QUOT10(carry, DECDPUN);
6544 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6545 carry=est-(DECDPUNMAX+1); /* correctly negative */
6547 if ((ueInt)carry<(DECDPUNMAX+1)*2){ /* fastpath carry 1 */
6548 *c=(Unit)(carry-(DECDPUNMAX+1));
6549 carry=1;
6553 if (carry>=0) {
6554 *c=(Unit)(carry%(DECDPUNMAX+1));
6555 carry=carry/(DECDPUNMAX+1);
6559 carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
6560 *c=(Unit)(carry%(DECDPUNMAX+1));
6561 carry=carry/(DECDPUNMAX+1)-(DECDPUNMAX+1);
6565 /* OK, all A and B processed; might still have carry or borrow */
6567 if (carry==0) return c-clsu; /* no carry, so no more to do */
6568 if (carry>0) { /* positive carry */
6569 *c=(Unit)carry; /* place as new unit */
6573 /* -ve carry: it's a borrow; complement needed */
6574 add=1; /* temporary carry... */
6588 printf("UAS borrow: add %ld, carry %ld\n", add, carry);
6590 if ((add-carry-1)!=0) {
6591 *c=(Unit)(add-carry-1);