Lines Matching refs:lhs

151 /*      lhs -- left hand side (operand, of an operation)              */
222 static Int decCompare (const decNumber * lhs, const decNumber * rhs);
677 /* lhs is A */
685 decNumberAdd (decNumber * res, const decNumber * lhs,
689 decAddOp (res, lhs, rhs, set, 0, &status);
701 /* lhs is A */
708 decNumberCompare (decNumber * res, const decNumber * lhs,
712 decCompareOp (res, lhs, rhs, set, COMPARE, &status);
724 /* lhs is A */
731 decNumberDivide (decNumber * res, const decNumber * lhs,
735 decDivideOp (res, lhs, rhs, set, DIVIDE, &status);
747 /* lhs is A */
754 decNumberDivideInteger (decNumber * res, const decNumber * lhs,
758 decDivideOp (res, lhs, rhs, set, DIVIDEINT, &status);
770 /* lhs is A */
777 decNumberMax (decNumber * res, const decNumber * lhs,
781 decCompareOp (res, lhs, rhs, set, COMPMAX, &status);
793 /* lhs is A */
800 decNumberMin (decNumber * res, const decNumber * lhs,
804 decCompareOp (res, lhs, rhs, set, COMPMIN, &status);
882 /* lhs is A */
889 decNumberMultiply (decNumber * res, const decNumber * lhs,
893 decMultiplyOp (res, lhs, rhs, set, &status);
967 /* lhs is A */
976 decNumberPower (decNumber * res, const decNumber * lhs,
979 decNumber *alloclhs = NULL; /* non-NULL if rounded lhs allocated */
998 /* same again for possible 1/lhs calculation */
1003 if (decCheckOperands (res, lhs, rhs, set))
1013 if (lhs->digits > reqdigits)
1015 alloclhs = decRoundOperand (lhs, set, &status);
1018 lhs = alloclhs;
1040 if ((lhs->bits | rhs->bits) & (DECNAN | DECSNAN))
1042 decNaNs (res, lhs, rhs, &status);
1061 if (decNumberIsNegative (lhs) /* -x .. */
1066 if (decNumberIsInfinite (lhs))
1097 /* [needbytes also used below if 1/lhs needed] */
1114 if (ISZERO (lhs)
1126 /* we'll invert the lhs now rather than inverting the result later */
1133 { /* need to calculate 1/lhs */
1135 /* divide lhs into 1, putting result in dac [dac=1/dac] */
1136 decDivideOp (dac, &dnOne, lhs, &workset, DIVIDE, &status);
1142 /* now locate or allocate space for the inverted lhs */
1155 /* [lhs now points to buffer or allocated storage] */
1156 decNumberCopy (newlhs, dac); /* copy the 1/lhs */
1158 lhs = newlhs;
1180 decMultiplyOp (dac, dac, lhs, &workset, &status); /* dac=dac*x */
1253 /* lhs is A, the number to adjust */
1263 decNumberQuantize (decNumber * res, const decNumber * lhs,
1267 decQuantizeOp (res, lhs, rhs, set, 1, &status);
1282 /* lhs is A, the number to adjust */
1292 decNumberRescale (decNumber * res, const decNumber * lhs,
1296 decQuantizeOp (res, lhs, rhs, set, 0, &status);
1308 /* lhs is A */
1315 decNumberRemainder (decNumber * res, const decNumber * lhs,
1319 decDivideOp (res, lhs, rhs, set, REMAINDER, &status);
1331 /* lhs is A */
1338 decNumberRemainderNear (decNumber * res, const decNumber * lhs,
1342 decDivideOp (res, lhs, rhs, set, REMNEAR, &status);
1352 /* lhs is a number to test */
1358 decNumberSameQuantum (decNumber * res, const decNumber * lhs, const decNumber * rhs)
1364 if (decCheckOperands (res, lhs, rhs, DECUNUSED))
1368 merged = (lhs->bits | rhs->bits) & DECSPECIAL;
1371 if (decNumberIsNaN (lhs) && decNumberIsNaN (rhs))
1373 else if (decNumberIsInfinite (lhs) && decNumberIsInfinite (rhs))
1377 else if (lhs->exponent == rhs->exponent)
1789 /* lhs is A */
1796 decNumberSubtract (decNumber * res, const decNumber * lhs,
1801 decAddOp (res, lhs, rhs, set, DECNEG, &status);
2202 /* lhs is A */
2230 decAddOp (decNumber * res, const decNumber * lhs,
2233 decNumber *alloclhs = NULL; /* non-NULL if rounded lhs allocated */
2251 if (decCheckOperands (res, lhs, rhs, set))
2261 if (lhs->digits > reqdigits)
2263 alloclhs = decRoundOperand (lhs, set, status);
2266 lhs = alloclhs;
2282 diffsign = (Flag) ((lhs->bits ^ rhs->bits ^ negate) & DECNEG);
2285 merged = (lhs->bits | rhs->bits) & DECSPECIAL;
2289 decNaNs (res, lhs, rhs, status);
2292 if (decNumberIsInfinite (lhs))
2300 bits = lhs->bits & DECNEG; /* get sign from LHS */
2312 if (ISZERO (lhs))
2315 Int lexp = lhs->exponent; /* save in case LHS==RES */
2316 bits = lhs->bits; /* .. */
2361 { /* [lhs is non-zero] */
2366 decCopyFit (res, lhs, set, &residue, status); /* copy (as needed) */
2395 padding = rhs->exponent - lhs->exponent;
2401 && rhs->digits <= reqdigits && lhs->digits <= reqdigits)
2403 Int partial = *lhs->lsu;
2407 if (lhs->digits < DECDPUN)
2408 maxv = powers[lhs->digits] - 1;
2412 if (res != lhs)
2413 decNumberCopy (res, lhs); /* not in place */
2424 if (res != lhs)
2425 decNumberCopy (res, lhs); /* not in place */
2435 /* Now align (pad) the lhs or rhs so we can add or subtract them, as
2443 bits = lhs->bits; /* assume sign is that of LHS */
2458 t = lhs;
2459 lhs = rhs;
2464 /* If, after pad, rhs would be longer than lhs by digits+1 or */
2465 /* more then lhs cannot affect the answer, except as a residue, */
2467 if (rhs->digits + padding > lhs->digits + reqdigits + 1)
2500 if (lhs->digits > maxdigits)
2501 maxdigits = lhs->digits;
2530 res->exponent = lhs->exponent; /* .. operands (even if aliased) */
2533 decDumpAr ('A', lhs->lsu, D2U (lhs->digits));
2539 res->digits = decUnitAddSub (lhs->lsu, D2U (lhs->digits), rhs->lsu, D2U (rhs->digits), rhsshift, acc, mult) * DECDPUN; /* [units -> digits] */
2647 /* lhs is A */
2704 /* var1 is a copy of the lhs coefficient, var2 is the rhs coefficient.*/
2708 const decNumber * lhs, const decNumber * rhs,
2711 decNumber *alloclhs = NULL; /* non-NULL if rounded lhs allocated */
2752 if (decCheckOperands (res, lhs, rhs, set))
2762 if (lhs->digits > reqdigits)
2764 alloclhs = decRoundOperand (lhs, set, status);
2767 lhs = alloclhs;
2780 bits = (lhs->bits ^ rhs->bits) & DECNEG; /* assumed sign for divisions */
2783 merged = (lhs->bits | rhs->bits) & DECSPECIAL;
2788 decNaNs (res, lhs, rhs, status);
2792 if (decNumberIsInfinite (lhs))
2810 /* result is [finished clone of] lhs */
2811 decCopyFit (res, lhs, set, &residue, status);
2833 if (ISZERO (lhs))
2835 decNumberZero (res); /* [after lhs test] */
2852 /* handle 0 lhs (0/x) */
2853 if (ISZERO (lhs))
2864 exponent = lhs->exponent - rhs->exponent; /* ideal exponent */
2865 decNumberCopy (res, lhs); /* [zeros always fit] */
2878 decNumberCopy (res, lhs); /* [zeros always fit] */
2893 (lhs->exponent + lhs->digits) - (rhs->exponent + rhs->digits);
2909 /* we can fastpath remainders so long as the lhs has the */
2911 if (lhs->exponent <= rhs->exponent)
2916 /* clone of] lhs (r = x - 0*y) */
2918 decCopyFit (res, lhs, set, &residue, status);
2947 /* or (lhs->digits) -- to allow for long lhs */
2954 if (lhs->digits > maxdigits)
2955 maxdigits = lhs->digits;
2971 /* Extend the lhs and rhs to full long subtraction length. The lhs */
2977 source = lhs->lsu + D2U (lhs->digits) - 1; /* msu of input array */
2978 for (target = msu1; source >= lhs->lsu; source--, target--)
3022 var1initpad = (var1units - D2U (lhs->digits)) * DECDPUN;
3037 maxexponent = lhs->exponent - rhs->exponent; /* save */
3249 Int exp = lhs->exponent; /* save min(exponents) */
3270 var1initpad + exponent - lhs->exponent + rhs->exponent;
3281 exponent = lhs->exponent; /* exponent is smaller of lhs & rhs */
3284 bits = lhs->bits; /* remainder sign is always as lhs */
3415 /* lhs is A */
3430 decMultiplyOp (decNumber * res, const decNumber * lhs,
3433 decNumber *alloclhs = NULL; /* non-NULL if rounded lhs allocated */
3449 if (decCheckOperands (res, lhs, rhs, set))
3459 if (lhs->digits > set->digits)
3461 alloclhs = decRoundOperand (lhs, set, status);
3464 lhs = alloclhs;
3478 bits = (uByte) ((lhs->bits ^ rhs->bits) & DECNEG);
3481 merged = (lhs->bits | rhs->bits) & DECSPECIAL;
3486 decNaNs (res, lhs, rhs, status);
3490 if (((lhs->bits & DECSPECIAL) == 0 && ISZERO (lhs))
3502 /* multiplier (rhs) and the longer as the multiplicand (lhs) */
3503 if (lhs->digits < rhs->digits)
3505 const decNumber *hold = lhs;
3506 lhs = rhs;
3511 need = D2U (lhs->digits) + D2U (rhs->digits); /* maximum units in result */
3531 madlength = D2U (lhs->digits); /* we know this won't change */
3541 decUnitAddSub (&acc[shift], accunits - shift, lhs->lsu,
3568 exponent = lhs->exponent + rhs->exponent; /* calculate exponent */
3569 if (lhs->exponent < 0 && rhs->exponent < 0 && exponent > 0)
3599 /* lhs is A, the number to adjust */
3612 decQuantizeOp (decNumber * res, const decNumber * lhs,
3615 decNumber *alloclhs = NULL; /* non-NULL if rounded lhs allocated */
3625 if (decCheckOperands (res, lhs, rhs, set))
3635 if (lhs->digits > reqdigits)
3637 alloclhs = decRoundOperand (lhs, set, status);
3640 lhs = alloclhs;
3654 merged = (lhs->bits | rhs->bits) & DECSPECIAL;
3655 if ((lhs->bits | rhs->bits) & DECSPECIAL)
3659 decNaNs (res, lhs, rhs, status);
3661 else if ((lhs->bits ^ rhs->bits) & DECINF)
3663 /* both infinity: return lhs */
3665 decNumberCopy (res, lhs); /* [nop if in place] */
3696 if (ISZERO (lhs))
3698 decNumberCopy (res, lhs); /* [nop if in place] */
3706 { /* non-zero lhs */
3707 Int adjust = reqexp - lhs->exponent; /* digit adjustment needed */
3709 if ((lhs->digits - adjust) > reqdigits)
3721 workset.digits = lhs->digits - adjust; /* set requested length */
3723 decCopyFit (res, lhs, &workset, &residue, status); /* fit to result */
3742 decNumberCopy (res, lhs); /* [it will fit] */
3782 /* lhs is A */
3795 decCompareOp (decNumber * res, const decNumber * lhs, const decNumber * rhs,
3798 decNumber *alloclhs = NULL; /* non-NULL if rounded lhs allocated */
3805 if (decCheckOperands (res, lhs, rhs, set))
3815 if (lhs->digits > set->digits)
3817 alloclhs = decRoundOperand (lhs, set, status);
3823 lhs = alloclhs;
3842 merged = (lhs->bits | rhs->bits) & (DECSNAN | DECNAN);
3850 if (lhs->bits & rhs->bits & DECNAN);
3855 if (lhs->bits & DECNAN)
3858 result = +1; /* pick lhs */
3863 decNaNs (res, lhs, rhs, status);
3867 result = decCompare (lhs, rhs); /* we have numbers */
3896 uByte slhs = (lhs->bits & DECNEG);
3911 result = +1; /* lhs is max */
3915 if (lhs->exponent < rhs->exponent)
3919 /* [if equal, we use lhs, technically identical] */
3923 if (lhs->exponent > rhs->exponent)
3933 choice = (result > 0 ? lhs : rhs); /* choose */
3959 decCompare (const decNumber * lhs, const decNumber * rhs)
3964 result = 1; /* assume signum(lhs) */
3965 if (ISZERO (lhs))
3967 else if (decNumberIsNegative (lhs))
3983 if ((lhs->bits | rhs->bits) & DECINF)
3985 if (lhs->bits == rhs->bits)
3993 if (lhs->exponent > rhs->exponent)
3996 const decNumber *temp = lhs;
3997 lhs = rhs;
4002 compare = decUnitCompare (lhs->lsu, D2U (lhs->digits),
4004 rhs->exponent - lhs->exponent);
5482 /* lhs is the first operand */
5492 decNaNs (decNumber * res, const decNumber * lhs, const decNumber * rhs, uInt * status)
5496 if (lhs->bits & DECSNAN)
5501 lhs = rhs;
5504 else if (lhs->bits & DECNAN);
5506 lhs = rhs;
5508 decNumberCopy (res, lhs);
5698 /* lhs is the first operand (may be DECUNUSED) */
5708 decCheckOperands (decNumber * res, const decNumber * lhs,
5738 if (!bad && lhs != DECUNUSED)
5739 bad = (decCheckNumber (lhs, set));