Lines Matching defs:shift

1363          * so the shift fits. */
1819 mpd_ssize_t adjexp, etiny, shift;
1872 * (1) shift = exp -emax+prec-1 > 0
1873 * (2) digits+shift = exp+digits-1 - emax + prec <= prec */
1874 shift = dec->exp - mpd_etop(ctx);
1875 if (!mpd_qshiftl(dec, dec, shift, status)) {
1878 dec->exp -= shift;
1902 * (1) shift = emin-prec+1 - exp > 0
1903 * (2) digits-shift = exp+digits-1 - emin + prec < prec */
1904 shift = etiny - dec->exp;
1905 rnd = (int)mpd_qshiftr_inplace(dec, shift);
1943 mpd_ssize_t shift;
1951 shift = dec->digits - ctx->prec;
1952 rnd = mpd_qshiftr_inplace(dec, shift);
1953 dec->exp += shift;
2148 * big and small, except that no allocation for the left shift is needed.
2152 mpd_size_t shift)
2163 assert(m > 0 && n >= m && shift > 0);
2165 _mpd_div_word(&q, &r, (mpd_uint_t)shift, MPD_RDIGITS);
2199 mpd_ssize_t shift, i;
2204 shift = a->exp - b->exp;
2205 if (shift > 0) {
2206 return -1 * _mpd_basecmp(b->data, a->data, b->len, a->len, shift);
2209 return _mpd_basecmp(a->data, b->data, a->len, b->len, -shift);
2536 /* special treatment for the most significant digit if shift == digits */
2587 * Inplace shift of the coefficient to the right, no check for specials.
3106 * Shift the coefficient by n digits, positive n is a left shift. In the case
3107 * of a left shift, the result is decapitated to fit the context precision. If
3139 * Same as mpd_shiftn(), but the shift is specified by the decimal b, which
3342 mpd_ssize_t newsize, shift;
3366 * bdigits+shift >= prec+2+sdigits AND
3369 * 1234567000000000 -> bdigits + shift
3377 * shift > sdigits AND
3380 * 1234567892100000 -> bdigits + shift
3399 shift = big->exp - small->exp;
3400 if (!mpd_qshiftl(&big_aligned, big, shift, status)) {
3759 mpd_ssize_t shift, exp, tz;
3791 shift = (b->digits - a->digits) + ctx->prec + 1;
3793 exp = ideal_exp - shift;
3794 if (shift > 0) {
3795 if (!mpd_qshiftl(&aligned, a, shift, status)) {
3801 else if (shift < 0) {
3802 shift = -shift;
3803 if (!mpd_qshiftl(&aligned, b, shift, status)) {
3852 shift = ideal_exp - exp;
3859 else if (action == SET_IDEAL_EXP && shift > 0) {
3861 shift = (tz > shift) ? shift : tz;
3862 mpd_qshiftr_inplace(q, shift);
3863 exp += shift;
3954 mpd_ssize_t ideal_exp, expdiff, shift;
3973 shift = a->exp - b->exp;
3974 if (!mpd_qshiftl(r, a, shift, status)) {
4000 shift = a->exp - b->exp;
4001 if (shift > 0) {
4002 /* by (3), after the shift a->digits <= prec + b->digits */
4003 if (!mpd_qshiftl(&aligned, a, shift, status)) {
4009 shift = -shift;
4010 /* by (2), after the shift b->digits <= a->digits */
4011 if (!mpd_qshiftl(&aligned, b, shift, status)) {
4283 mpd_ssize_t shift = ctx->prec - result->digits;
4284 mpd_qshiftl(result, result, shift, status);
4285 result->exp -= shift;
4714 mpd_ssize_t shift;
4719 shift = MPD_MINALLOC_MAX*MPD_RDIGITS-prec;
4720 shift = shift < 0 ? 0 : shift;
4722 rnd = mpd_qshiftr(result, &_mpd_ln10, shift, status);
4851 mpd_ssize_t maxprec, shift, t;
4956 shift = v.digits - varcontext.prec;
4957 mpd_qshiftr(&vtmp, &v, shift, status);
4958 vtmp.exp += shift;
6427 mpd_ssize_t shift;
6431 shift = ctx->prec-1;
6432 mpd_qshiftl(result, &one, shift, status);
6433 result->exp = -shift;
6454 mpd_ssize_t shift;
6470 shift = mpd_qget_ssize(result, &workstatus);
6471 /* shift is MPD_SSIZE_MAX if result is too large */
6472 if (shift > ctx->prec-1) {
6473 shift = ctx->prec-1;
6478 shift = ctx->prec-1;
6484 if (!mpd_qshiftl(result, &one, shift, status)) {
6487 result->exp = -shift;
6789 mpd_ssize_t shift = ctx->prec-1;
6790 mpd_qshiftl(result, &one, shift, status);
6791 result->exp = -shift;
6966 mpd_ssize_t expdiff, shift;
7000 shift = expdiff;
7001 if (!mpd_qshiftl(result, a, shift, status)) {
7008 * so the shift before an increment will fit in prec. */
7009 shift = -expdiff;
7010 rnd = mpd_qshiftr(result, a, shift, status);
7038 mpd_ssize_t shift, maxexp, maxshift;
7061 shift = mpd_trail_zeros(result);
7065 shift = (shift > maxshift) ? maxshift : shift;
7067 mpd_qshiftr_inplace(result, shift);
7068 result->exp += shift;
7207 mpd_ssize_t expdiff, shift;
7222 shift = expdiff;
7223 if (a->digits + shift > MPD_MAX_PREC+1) {
7227 if (!mpd_qshiftl(result, a, shift, status)) {
7233 shift = -expdiff;
7234 rnd = mpd_qshiftr(result, a, shift, status);
7765 mpd_ssize_t ideal_exp, shift;
7819 shift = v->digits - varcontext.prec;
7820 mpd_qshiftr(&t, v, shift, &workstatus);
7821 t.exp += shift;
7835 shift = ideal_exp - result->exp;
7836 shift = (tz > shift) ? shift : tz;
7837 if (shift > 0) {
7838 mpd_qshiftr_inplace(result, shift);
7839 result->exp += shift;
7898 mpd_ssize_t l, shift;
7943 shift = prec - l;
7944 if (shift >= 0) {
7945 if (!mpd_qshiftl(&c, &c, 2*shift, status)) {
7951 exact = !mpd_qshiftr_inplace(&c, -2*shift);
7954 ideal_exp -= shift;
7988 if (shift >= 0) {
7989 mpd_qshiftr_inplace(result, shift);
7992 if (!mpd_qshiftl(result, result, -shift, status)) {
7996 ideal_exp += shift;