Lines Matching full:carry
1082 /* If not violated then carry out the operation. */
1300 /* then carry out the operation. */
1442 /* then carry out the operation. */
2195 else { /* carry on with integer */
3036 /* Carry out the Hull correction */
3816 /* -- a carry to digits+1 digits looks possible */
3969 /* is all in one unit, no operand rounding is needed, and no carry, */
4062 /* If destructive overlap, or the number is too long, or a carry or */
4068 /* needed, +1 Unit for carry or borrow */
4855 /* chunks, and also uses a lazy carry strategy to minimise expensive */
4890 #define FASTLAZY 18 /* carry resolution point [1->18] */
4894 #define FASTLAZY 1844 /* carry resolution point [1->1844] */
4898 /* lazy carry evaluation */
4914 Int lazy; /* lazy carry counter */
4915 uLong lcarry; /* uLong carry */
4916 uInt carry; /* carry (NB not uLong) */
5051 /* a uLong without overflowing, so intermediate carry */
5053 /* short numbers usually only the one final carry resolution */
5058 lazy=FASTLAZY; /* carry delay count */
5075 if (lcarry<FASTBASE) carry=(uInt)lcarry; /* [usual] */
5076 else { /* two-place carry [fairly rare] */
5080 carry=(uInt)(lcarry-((uLong)FASTBASE*carry2)); /* [inline] */
5082 *(lp+1)+=carry; /* add to item above [inline] */
5083 *lp-=((uLong)FASTBASE*carry); /* [inline] */
5084 } /* carry resolution */
5516 a=t; /* and carry on using t instead of a */
6345 /* shift), or one Unit longer than that (if a Unit carry occurred). */
6367 /* safe, allowing space if necessary for a one-Unit carry. */
6386 eInt carry=0; /* carry integer (could be Long) */
6420 /* Carry handling is the same (i.e., duplicated) in each case. */
6422 carry+=*a;
6424 carry+=((eInt)*b)*m; /* [special-casing m=1/-1 */
6426 /* here carry is new Unit of digits; it could be +ve or -ve */
6427 if ((ueInt)carry<=DECDPUNMAX) { /* fastpath 0-DECDPUNMAX */
6428 *c=(Unit)carry;
6429 carry=0;
6433 if (carry>=0) {
6434 est=(((ueInt)carry>>11)*53687)>>18;
6435 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6436 carry=est; /* likely quotient [89%] */
6438 carry++;
6443 carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
6444 est=(((ueInt)carry>>11)*53687)>>18;
6445 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6446 carry=est-(DECDPUNMAX+1); /* correctly negative */
6448 carry++;
6451 if (carry>=0) {
6452 est=(((ueInt)carry>>3)*16777)>>21;
6453 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6454 carry=est; /* likely quotient [99%] */
6456 carry++;
6461 carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
6462 est=(((ueInt)carry>>3)*16777)>>21;
6463 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6464 carry
6466 carry++;
6469 /* Can use QUOT10 as carry <= 4 digits */
6470 if (carry>=0) {
6471 est=QUOT10(carry, DECDPUN);
6472 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6473 carry=est; /* quotient */
6477 carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
6478 est=QUOT10(carry, DECDPUN);
6479 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6480 carry=est-(DECDPUNMAX+1); /* correctly negative */
6483 if ((ueInt)carry<(DECDPUNMAX+1)*2) { /* fastpath carry +1 */
6484 *c=(Unit)(carry-(DECDPUNMAX+1)); /* [helps additions] */
6485 carry=1;
6488 if (carry>=0) {
6489 *c=(Unit)(carry%(DECDPUNMAX+1));
6490 carry=carry/(DECDPUNMAX+1);
6494 carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
6495 *c=(Unit)(carry%(DECDPUNMAX+1));
6496 carry=carry/(DECDPUNMAX+1)-(DECDPUNMAX+1);
6504 carry+=*a;
6508 carry+=((eInt)*b)*m;
6511 /* here carry is new Unit of digits; it could be +ve or -ve and */
6513 if ((ueInt)carry<=DECDPUNMAX) { /* fastpath 0-DECDPUNMAX */
6514 *c=(Unit)carry;
6515 carry=0;
6520 if (carry>=0) {
6521 est=(((ueInt)carry>>11)*53687)>>18;
6522 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6523 carry=est; /* likely quotient [79.7%] */
6525 carry++;
6530 carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
6531 est=(((ueInt)carry>>11)*53687)>>18;
6532 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6533 carry=est-(DECDPUNMAX+1); /* correctly negative */
6535 carry++;
6538 if (carry>=0) {
6539 est=(((ueInt)carry>>3)*16777)>>21;
6540 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6541 carry=est; /* likely quotient [99%] */
6543 carry++;
6548 carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
6549 est=(((ueInt)carry>>3)*16777)>>21;
6550 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6551 carry=est-(DECDPUNMAX+1); /* correctly negative */
6553 carry++;
6556 if (carry>=0) {
6557 est=QUOT10(carry, DECDPUN);
6558 *c=(Unit)(carry-est*(DECDPUNMAX+1)); /* remainder */
6559 carry=est; /* quotient */
6563 carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
6564 est=QUOT10(carry, DECDPUN);
6565 *c=(Unit)(carry-est*(DECDPUNMAX+1));
6566 carry=est-(DECDPUNMAX+1); /* correctly negative */
6568 if ((ueInt)carry<(DECDPUNMAX+1)*2){ /* fastpath carry 1 */
6569 *c=(Unit)(carry-(DECDPUNMAX+1));
6570 carry=1;
6574 if (carry>=0) {
6575 *c=(Unit)(carry%(DECDPUNMAX+1));
6576 carry=carry/(DECDPUNMAX+1);
6580 carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); /* make positive */
6581 *c=(Unit)(carry%(DECDPUNMAX+1));
6582 carry=carry/(DECDPUNMAX+1)-(DECDPUNMAX+1);
6586 /* OK, all A and B processed; might still have carry or borrow */
6588 if (carry==0) return c-clsu; /* no carry, so no more to do */
6589 if (carry>0) { /* positive carry */
6590 *c=(Unit)carry; /* place as new unit */
6594 /* -ve carry: it's a borrow; complement needed */
6595 add=1; /* temporary carry... */
6609 printf("UAS borrow: add %ld, carry %ld\n", add, carry);
6611 if ((add-carry-1)!=0) {
6612 *c=(Unit)(add-carry-1);