Lines Matching refs:exp
82 #define MPD_NEW_STATIC(name, flags, exp, digits, len) \ argument
84 mpd_t name = {flags|MPD_STATIC|MPD_STATIC_DATA, exp, digits, \
87 #define MPD_NEW_CONST(name, flags, exp, digits, len, alloc, initval) \ argument
89 mpd_t name = {flags|MPD_STATIC|MPD_CONST_DATA, exp, digits, \
94 a->exp, a->digits, a->len, a->alloc, a->data}
107 mpd_ssize_t exp);
119 mpd_uint_t exp, uint8_t resultsign,
204 return (dec->exp + dec->digits) - 1; in mpd_adjexp()
258 mpd_exp_digits(mpd_ssize_t exp) in mpd_exp_digits() argument
260 exp = (exp < 0) ? -exp : exp; in mpd_exp_digits()
261 return mpd_word_digits(exp); in mpd_exp_digits()
835 _settriple(result, mpd_sign(result), 0, result->exp); in _mpd_cap()
959 return (dec->exp + tz >= 0); in _mpd_isint()
1033 if (dec->exp < 0) { in mpd_isodd()
1034 _mpd_div_word(&q, &r, -dec->exp, MPD_RDIGITS); in mpd_isodd()
1038 return dec->exp == 0 && mpd_isoddword(dec->data[0]); in mpd_isodd()
1054 _ssettriple(mpd_t *result, uint8_t sign, mpd_uint_t a, mpd_ssize_t exp) in _ssettriple() argument
1057 result->exp = exp; in _ssettriple()
1065 _settriple(mpd_t *result, uint8_t sign, mpd_uint_t a, mpd_ssize_t exp) in _settriple() argument
1069 result->exp = exp; in _settriple()
1082 result->exp = result->digits = result->len = 0; in mpd_setspecial()
1092 result->exp = result->digits = result->len = 0; in mpd_seterror()
1222 result->exp = 0; in _c32setu64()
1352 if (a->digits+a->exp > MPD_RDIGITS+1) { in _mpd_qget_uint()
1357 if (a->exp < 0) { in _mpd_qget_uint()
1367 mpd_qsshiftr(&tmp, a, -a->exp); in _mpd_qget_uint()
1368 tmp.exp = 0; in _mpd_qget_uint()
1378 if (a->exp > 0) { in _mpd_qget_uint()
1379 _mpd_mul_words(&hi, &lo, lo, mpd_pow10[a->exp]); in _mpd_qget_uint()
1752 dec->exp += 1; in _mpd_apply_round()
1759 dec->exp += 1; in _mpd_apply_round()
1826 dec->exp = ctx->emax; in _mpd_check_exp()
1828 dec->exp -= (ctx->prec-1); in _mpd_check_exp()
1843 dec->exp = ctx->emax - ctx->prec + 1; in _mpd_check_exp()
1848 dec->exp = ctx->emax - ctx->prec + 1; in _mpd_check_exp()
1857 dec->exp = ctx->emax - ctx->prec + 1; in _mpd_check_exp()
1870 else if (ctx->clamp && dec->exp > mpd_etop(ctx)) { in _mpd_check_exp()
1874 shift = dec->exp - mpd_etop(ctx); in _mpd_check_exp()
1878 dec->exp -= shift; in _mpd_check_exp()
1891 if (dec->exp < etiny) { in _mpd_check_exp()
1892 dec->exp = etiny; in _mpd_check_exp()
1900 if (dec->exp < etiny) { in _mpd_check_exp()
1904 shift = etiny - dec->exp; in _mpd_check_exp()
1906 dec->exp = etiny; in _mpd_check_exp()
1933 dec->exp < mpd_etiny(ctx)) { in mpd_check_underflow()
1953 dec->exp += shift; in _mpd_check_round()
1987 dest->exp = src->exp; in _mpd_copy_shared()
2009 result->exp = a->exp; in mpd_qcopy()
2028 result->exp = a->exp; in mpd_qcopy_cxx()
2048 result->exp = a->exp; in mpd_qcopy_static()
2067 result->exp = a->exp; in mpd_qncopy()
2201 if (a->exp != b->exp) { in _mpd_cmp_same_adjexp()
2204 shift = a->exp - b->exp; in _mpd_cmp_same_adjexp()
2400 aa.exp = bb.exp = 0; in mpd_cmp_total()
2418 if (c == 0 && a->exp != b->exp) { in mpd_cmp_total()
2419 c = (a->exp < b->exp) ? -1 : 1; in mpd_cmp_total()
2484 c = (a->exp < b->exp) ? -1 : 1; in _mpd_cmp_numequal()
2521 result->exp = a->exp; in mpd_qshiftl()
2581 result->exp = a->exp; in mpd_qsshiftr()
2666 result->exp = a->exp; in mpd_qshiftr()
2688 a->exp != 0 || b->exp != 0) { in mpd_qand()
2756 result->exp = 0; in mpd_qand()
2809 if (mpd_isspecial(a) || mpd_isnegative(a) || a->exp != 0) { in mpd_qinvert()
2836 result->exp = 0; in mpd_qinvert()
2879 a->exp != 0 || b->exp != 0) { in mpd_qor()
2949 result->exp = 0; in mpd_qor()
2979 if (b->exp != 0 || mpd_isinfinite(b)) { in mpd_qrotate()
3047 int64_t exp; in mpd_qscaleb() local
3051 mpd_ssize_t exp; in mpd_qscaleb() local
3059 if (b->exp != 0 || mpd_isinfinite(b)) { in mpd_qscaleb()
3078 exp = a->exp + (int64_t)n * mpd_arith_sign(b); in mpd_qscaleb()
3079 exp = (exp > MPD_EXP_INF) ? MPD_EXP_INF : exp; in mpd_qscaleb()
3080 exp = (exp < MPD_EXP_CLAMP) ? MPD_EXP_CLAMP : exp; in mpd_qscaleb()
3082 x = (a->exp < 0) ? -a->exp : a->exp; in mpd_qscaleb()
3083 x_sign = (a->exp < 0) ? 1 : 0; in mpd_qscaleb()
3096 exp = x_sign ? -((mpd_ssize_t)x) : (mpd_ssize_t)x; in mpd_qscaleb()
3100 result->exp = (mpd_ssize_t)exp; in mpd_qscaleb()
3154 if (b->exp != 0 || mpd_isinfinite(b)) { in mpd_qshift()
3198 a->exp != 0 || b->exp != 0) { in mpd_qxor()
3268 result->exp = 0; in mpd_qxor()
3343 mpd_ssize_t exp, i; in _mpd_qaddsub() local
3349 if (big->exp != small->exp) { in _mpd_qaddsub()
3350 if (small->exp > big->exp) { in _mpd_qaddsub()
3356 exp = big->exp - 1; in _mpd_qaddsub()
3357 exp += (big->digits > ctx->prec) ? 0 : big->digits-ctx->prec-1; in _mpd_qaddsub()
3358 if (mpd_adjexp(small) < exp) { in _mpd_qaddsub()
3392 tiny.exp = exp; in _mpd_qaddsub()
3399 shift = big->exp - small->exp; in _mpd_qaddsub()
3407 result->exp = small->exp; in _mpd_qaddsub()
3759 mpd_ssize_t shift, exp, tz; in _mpd_qdiv() local
3785 exp = a->exp - b->exp; in _mpd_qdiv()
3786 _settriple(q, sign_a^sign_b, 0, exp); in _mpd_qdiv()
3792 ideal_exp = a->exp - b->exp; in _mpd_qdiv()
3793 exp = ideal_exp - shift; in _mpd_qdiv()
3852 shift = ideal_exp - exp; in _mpd_qdiv()
3863 exp += shift; in _mpd_qdiv()
3866 q->exp = exp; in _mpd_qdiv()
3959 ideal_exp = (a->exp > b->exp) ? b->exp : a->exp; in _mpd_qdivmod()
3964 r->exp = ideal_exp; in _mpd_qdivmod()
3971 if (a->exp > b->exp) { in _mpd_qdivmod()
3973 shift = a->exp - b->exp; in _mpd_qdivmod()
3977 r->exp = ideal_exp; in _mpd_qdivmod()
3999 if (a->exp != b->exp) { in _mpd_qdivmod()
4000 shift = a->exp - b->exp; in _mpd_qdivmod()
4066 q->exp = 0; in _mpd_qdivmod()
4078 r->exp = ideal_exp; in _mpd_qdivmod()
4285 result->exp -= shift; in _mpd_zeropad()
4416 t = a->digits + a->exp; in _mpd_qexp()
4444 result->exp -= t; in _mpd_qexp()
4541 ulpexp = result->exp + result->digits - workctx.prec; in mpd_qexp()
4544 ulpexp = result->exp; in mpd_qexp()
4727 result->exp = -(result->digits-1); in mpd_qln10()
4740 i = ln_schedule_prec(klist, prec+2, -result->exp); in mpd_qln10()
4875 a_exp = a->exp; in _mpd_qln()
4881 z->exp = -3; in _mpd_qln()
4888 v.exp = -(a_digits - 1); in _mpd_qln()
4895 v.exp = -a_digits; in _mpd_qln()
4927 tmp.exp += 1; in _mpd_qln()
4935 tmp.exp -= 1; in _mpd_qln()
4958 vtmp.exp += shift; in _mpd_qln()
5093 result->exp + result->digits-workctx.prec); in mpd_qln()
5242 result->exp + result->digits-workctx.prec); in mpd_qlog10()
5983 result->exp = big->exp + small->exp; in _mpd_qmul()
6165 result->exp = mpd_etop(ctx); in mpd_qnext_minus()
6212 result->exp = mpd_etop(ctx); in mpd_qnext_plus()
6284 _mpd_qpow_uint(mpd_t *result, const mpd_t *base, mpd_uint_t exp, in _mpd_qpow_uint() argument
6290 if (exp == 0) { in _mpd_qpow_uint()
6299 n = mpd_bits[mpd_bsr(exp)]; in _mpd_qpow_uint()
6302 if (exp & n) { in _mpd_qpow_uint()
6364 _mpd_qpow_int(mpd_t *result, const mpd_t *base, const mpd_t *exp, in _mpd_qpow_int() argument
6375 workctx.prec += (exp->digits + exp->exp + 2); in _mpd_qpow_int()
6378 if (mpd_isnegative(exp)) { in _mpd_qpow_int()
6395 n = mpd_qabs_uint(exp, &workctx.status); in _mpd_qpow_int()
6397 if (!mpd_qcopy(&texp, exp, status)) { in _mpd_qpow_int()
6433 result->exp = -shift; in _qcheck_pow_one_inf()
6449 _qcheck_pow_one(mpd_t *result, const mpd_t *base, const mpd_t *exp, in _qcheck_pow_one() argument
6458 if (_mpd_isint(exp)) { in _qcheck_pow_one()
6459 if (mpd_isnegative(exp)) { in _qcheck_pow_one()
6464 mpd_qmul_ssize(result, exp, -base->exp, ctx, &workstatus); in _qcheck_pow_one()
6487 result->exp = -shift; in _qcheck_pow_one()
6656 _mpd_qpow_real(mpd_t *result, const mpd_t *base, const mpd_t *exp, in _mpd_qpow_real() argument
6662 if (!mpd_qcopy(&texp, exp, status)) { in _mpd_qpow_real()
6708 mpd_qpow(mpd_t *result, const mpd_t *base, const mpd_t *exp, in mpd_qpow() argument
6715 if (mpd_isspecial(base) || mpd_isspecial(exp)) { in mpd_qpow()
6716 if (mpd_qcheck_nans(result, base, exp, ctx, status)) { in mpd_qpow()
6720 if (mpd_isinteger(exp)) { in mpd_qpow()
6722 resultsign = mpd_isnegative(base) && mpd_isodd(exp); in mpd_qpow()
6726 if (mpd_iszero(exp)) { in mpd_qpow()
6729 else if (mpd_isnegative(exp)) { in mpd_qpow()
6738 if (!intexp || mpd_isinfinite(exp)) { in mpd_qpow()
6743 if (mpd_isinfinite(exp)) { in mpd_qpow()
6750 cmp *= mpd_arith_sign(exp); in mpd_qpow()
6761 if (mpd_iszero(exp)) { in mpd_qpow()
6764 else if (mpd_isnegative(exp)) { in mpd_qpow()
6772 if (mpd_iszero(exp)) { in mpd_qpow()
6776 if (_qcheck_pow_one(result, base, exp, resultsign, ctx, status) == 0) { in mpd_qpow()
6779 if (_qcheck_pow_bounds(result, base, exp, resultsign, ctx, status)) { in mpd_qpow()
6784 _mpd_qpow_int(result, base, exp, resultsign, ctx, status); in mpd_qpow()
6787 _mpd_qpow_real(result, base, exp, ctx, status); in mpd_qpow()
6791 result->exp = -shift; in mpd_qpow()
6806 _mpd_qpowmod_uint(mpd_t *result, mpd_t *base, mpd_uint_t exp, in _mpd_qpowmod_uint() argument
6816 while (exp > 0) { in _mpd_qpowmod_uint()
6817 if (exp & 1) { in _mpd_qpowmod_uint()
6823 exp >>= 1; in _mpd_qpowmod_uint()
6829 mpd_qpowmod(mpd_t *result, const mpd_t *base, const mpd_t *exp, in mpd_qpowmod() argument
6846 if (mpd_isspecial(base) || mpd_isspecial(exp) || mpd_isspecial(mod)) { in mpd_qpowmod()
6847 if (mpd_qcheck_3nans(result, base, exp, mod, ctx, status)) { in mpd_qpowmod()
6855 if (!_mpd_isint(base) || !_mpd_isint(exp) || !_mpd_isint(mod)) { in mpd_qpowmod()
6863 if (mod->digits+mod->exp > ctx->prec) { in mpd_qpowmod()
6868 sign = (mpd_isnegative(base)) && (mpd_isodd(exp)); in mpd_qpowmod()
6869 if (mpd_iszerocoeff(exp)) { in mpd_qpowmod()
6878 if (mpd_isnegative(exp)) { in mpd_qpowmod()
6899 tbase_exp = tbase.exp; in mpd_qpowmod()
6900 tbase.exp = 0; in mpd_qpowmod()
6902 mpd_qround_to_int(&texp, exp, &maxcontext, status); in mpd_qpowmod()
6903 texp_exp = texp.exp; in mpd_qpowmod()
6904 texp.exp = 0; in mpd_qpowmod()
6965 mpd_ssize_t b_exp = b->exp; in mpd_qquantize()
6981 if (b->exp > ctx->emax || b->exp < mpd_etiny(ctx)) { in mpd_qquantize()
6987 _settriple(result, mpd_sign(a), 0, b->exp); in mpd_qquantize()
6993 expdiff = a->exp - b->exp; in mpd_qquantize()
7004 result->exp = b_exp; in mpd_qquantize()
7014 result->exp = b_exp; in mpd_qquantize()
7064 maxshift = maxexp - result->exp; in mpd_qreduce()
7068 result->exp += shift; in mpd_qreduce()
7204 _mpd_qrescale(mpd_t *result, const mpd_t *a, mpd_ssize_t exp, in _mpd_qrescale() argument
7216 _settriple(result, mpd_sign(a), 0, exp); in _mpd_qrescale()
7220 expdiff = a->exp - exp; in _mpd_qrescale()
7230 result->exp = exp; in _mpd_qrescale()
7238 result->exp = exp; in _mpd_qrescale()
7260 mpd_qrescale(mpd_t *result, const mpd_t *a, mpd_ssize_t exp, in mpd_qrescale() argument
7263 if (exp > MPD_MAX_EMAX+1 || exp < MPD_MIN_ETINY) { in mpd_qrescale()
7268 _mpd_qrescale(result, a, exp, ctx, status); in mpd_qrescale()
7280 mpd_qrescale_fmt(mpd_t *result, const mpd_t *a, mpd_ssize_t exp, in mpd_qrescale_fmt() argument
7283 if (exp > MPD_MAX_EMAX+1 || exp < MPD_MIN_ETINY-MPD_MAX_PREC) { in mpd_qrescale_fmt()
7288 _mpd_qrescale(result, a, exp, ctx, status); in mpd_qrescale_fmt()
7306 if (a->exp >= 0) { in _mpd_qround_to_integral()
7315 rnd = mpd_qshiftr(result, a, -a->exp, status); in _mpd_qround_to_integral()
7319 result->exp = 0; in _mpd_qround_to_integral()
7398 return a->exp == b->exp; in mpd_same_quantum()
7436 assert(v->exp == -v->digits); in _mpd_qreciprocal_approx()
7446 z->exp = -(MPD_RDIGITS-2); in _mpd_qreciprocal_approx()
7477 adj = v->digits + v->exp; in _mpd_qreciprocal()
7478 v->exp = -v->digits; in _mpd_qreciprocal()
7503 t.exp = -varcontext.prec; in _mpd_qreciprocal()
7520 z->exp -= adj; in _mpd_qreciprocal()
7558 aa.exp = 0; in _mpd_base_ndivmod()
7559 bb.exp = 0; in _mpd_base_ndivmod()
7743 z->exp = -6; in _invroot_init_approx()
7772 ideal_exp = -(a->exp - (a->exp & 1)) / 2; in _mpd_qinvroot()
7783 if ((v->digits+v->exp) & 1) { in _mpd_qinvroot()
7785 v->exp = -fracdigits; in _mpd_qinvroot()
7795 v->exp = -fracdigits; in _mpd_qinvroot()
7803 adj = (a->exp-v->exp) / 2; in _mpd_qinvroot()
7821 t.exp += shift; in _mpd_qinvroot()
7832 z->exp -= adj; in _mpd_qinvroot()
7835 shift = ideal_exp - result->exp; in _mpd_qinvroot()
7839 result->exp += shift; in _mpd_qinvroot()
7902 ideal_exp = (a->exp - (a->exp & 1)) / 2; in _mpd_qsqrt()
7931 c.exp = 0; in _mpd_qsqrt()
7933 if (a->exp & 1) { in _mpd_qsqrt()
8005 result->exp = ideal_exp; in _mpd_qsqrt()
8092 digits = a->digits+a->exp; in mpd_sizeinbase()
8408 if (src->exp >= 0) { in mpd_qexport_u16()
8409 if (!mpd_qshiftl(&tsrc, src, src->exp, status)) { in mpd_qexport_u16()
8414 if (mpd_qshiftr(&tsrc, src, -src->exp, status) == MPD_UINT_MAX) { in mpd_qexport_u16()
8485 if (src->exp >= 0) { in mpd_qexport_u32()
8486 if (!mpd_qshiftl(&tsrc, src, src->exp, status)) { in mpd_qexport_u32()
8491 if (mpd_qshiftr(&tsrc, src, -src->exp, status) == MPD_UINT_MAX) { in mpd_qexport_u32()
8575 result->exp = 0; in mpd_qimport_u16()
8651 result->exp = 0; in mpd_qimport_u32()
8742 _set_uint128_coeff_exp(mpd_t *result, uint64_t hi, uint64_t lo, mpd_ssize_t exp) in _set_uint128_coeff_exp() argument
8762 result->exp = exp; in _set_uint128_coeff_exp()
8787 mpd_ssize_t exp; in mpd_from_uint128_triple() local
8790 if (triple->exp < MPD_SSIZE_MIN || triple->exp > MPD_SSIZE_MAX) { in mpd_from_uint128_triple()
8794 exp = (mpd_ssize_t)triple->exp; in mpd_from_uint128_triple()
8798 if (sign > 1 || exp != 0) { in mpd_from_uint128_triple()
8809 if (_set_uint128_coeff_exp(result, hi, lo, exp) < 0) { in mpd_from_uint128_triple()
8817 if (sign > 1 || hi != 0 || lo != 0 || exp != 0) { in mpd_from_uint128_triple()
8834 if (exp > MPD_EXP_INF) { in mpd_from_uint128_triple()
8835 exp = MPD_EXP_INF; in mpd_from_uint128_triple()
8837 if (exp == MPD_SSIZE_MIN) { in mpd_from_uint128_triple()
8838 exp = MPD_SSIZE_MIN+1; in mpd_from_uint128_triple()
8841 if (_set_uint128_coeff_exp(result, hi, lo, exp) < 0) { in mpd_from_uint128_triple()
8983 coeff.exp = 0; in _coeff_as_uint128()
9005 triple.exp = a->exp; in mpd_as_uint128_triple()