Lines Matching refs:base

118 static inline void _mpd_qpow_uint(mpd_t *result, const mpd_t *base,
5736 * Karatsuba multiplication with FNT/basemul as the base case.
5834 * base case. Returns a pointer to the result or NULL in case of failure
6284 _mpd_qpow_uint(mpd_t *result, const mpd_t *base, mpd_uint_t exp,
6295 if (!mpd_qcopy(result, base, status)) {
6303 mpd_qmul(result, result, base, ctx, &workstatus);
6361 * abs(result - base**exp) < 0.1 * 10**-prec * abs(base**exp)
6364 _mpd_qpow_int(mpd_t *result, const mpd_t *base, const mpd_t *exp,
6381 mpd_qdiv(&tbase, &one, base, &workctx, &workstatus);
6389 if (!mpd_qcopy(&tbase, base, status)) {
6419 * If the exponent is infinite and base equals one, the result is one
6424 _qcheck_pow_one_inf(mpd_t *result, const mpd_t *base, uint8_t resultsign,
6430 if ((cmp = _mpd_cmp(base, &one)) == 0) {
6442 * If abs(base) equals one, calculate the correct power of one result.
6449 _qcheck_pow_one(mpd_t *result, const mpd_t *base, const mpd_t *exp,
6457 if ((cmp = _mpd_cmp_abs(base, &one)) == 0) {
6464 mpd_qmul_ssize(result, exp, -base->exp, ctx, &workstatus);
6477 else if (mpd_ispositive(base)) {
6501 * x: base
6644 _mpd_qpow_exact(mpd_t *result, const mpd_t *base, const mpd_t *exp,
6656 _mpd_qpow_real(mpd_t *result, const mpd_t *base, const mpd_t *exp,
6668 workctx.prec = (base->digits > ctx->prec) ? base->digits : ctx->prec;
6677 * y := log(base) * exp
6697 mpd_qln(result, base, &workctx, &workctx.status);
6706 /* The power function: base**exp */
6708 mpd_qpow(mpd_t *result, const mpd_t *base, const mpd_t *exp,
6715 if (mpd_isspecial(base) || mpd_isspecial(exp)) {
6716 if (mpd_qcheck_nans(result, base, exp, ctx, status)) {
6722 resultsign = mpd_isnegative(base) && mpd_isodd(exp);
6725 if (mpd_iszero(base)) {
6737 if (mpd_isnegative(base)) {
6745 cmp = _qcheck_pow_one_inf(result, base, resultsign, ctx, status);
6760 if (mpd_isinfinite(base)) {
6776 if (_qcheck_pow_one(result, base, exp, resultsign, ctx, status) == 0) {
6779 if (_qcheck_pow_bounds(result, base, exp, resultsign, ctx, status)) {
6784 _mpd_qpow_int(result, base, exp, resultsign, ctx, status);
6787 _mpd_qpow_real(result, base, exp, ctx, status);
6802 * Internal function: Integer powmod with mpd_uint_t exponent, base is modified!
6806 _mpd_qpowmod_uint(mpd_t *result, mpd_t *base, mpd_uint_t exp,
6818 _mpd_qmul_exact(result, result, base, &maxcontext, status);
6821 _mpd_qmul_exact(base, base, base, &maxcontext, status);
6822 mpd_qrem(base, base, mod, &maxcontext, status);
6827 /* The powmod function: (base**exp) % mod */
6829 mpd_qpowmod(mpd_t *result, const mpd_t *base, const mpd_t *exp,
6846 if (mpd_isspecial(base) || mpd_isspecial(exp) || mpd_isspecial(mod)) {
6847 if (mpd_qcheck_3nans(result, base, exp, mod, ctx, status)) {
6855 if (!_mpd_isint(base) || !_mpd_isint(exp) || !_mpd_isint(mod)) {
6868 sign = (mpd_isnegative(base)) && (mpd_isodd(exp));
6870 if (mpd_iszerocoeff(base)) {
6882 if (mpd_iszerocoeff(base)) {
6897 mpd_qround_to_int(&tbase, base, &maxcontext, status);
6906 /* base = (base.int % modulo * pow(10, base.exp, modulo)) % modulo */
8077 /* Space needed to represent an integer mpd_t in base 'base'. */
8079 mpd_sizeinbase(const mpd_t *a, uint32_t base)
8086 assert(base >= 2);
8105 x = (double)digits / log10(base);
8109 /* Space needed to import a base 'base' integer of length 'srclen'. */
8111 _mpd_importsize(size_t srclen, uint32_t base)
8117 assert(base >= 2);
8130 x = (double)srclen * (log10(base)/MPD_RDIGITS);
8213 /* target base wbase < source base ubase */
8240 /* target base 'wbase' == source base 'ubase' */
8255 /* target base 'wbase' > source base 'ubase' */
8293 /* target base wbase < source base ubase */
8321 /* target base 'wbase' > source base 'ubase' */
8361 * Convert an integer mpd_t to a multiprecision integer with base <= 2**16.
8440 * Convert an integer mpd_t to a multiprecision integer with base<=UINT32_MAX.
8534 * Converts a multiprecision integer with base <= UINT16_MAX+1 to an mpd_t.
8588 * Converts a multiprecision integer with base <= UINT32_MAX to an mpd_t.