Lines Matching defs:digits
39 #define _MAX_STR_DIGITS_ERROR_FMT_TO_INT "Exceeds the limit (%d digits) for integer string conversion: value has %zd digits; use sys.set_int_max_str_digits() to increase the limit"
40 #define _MAX_STR_DIGITS_ERROR_FMT_TO_STR "Exceeds the limit (%d digits) for integer string conversion; use sys.set_int_max_str_digits() to increase the limit"
80 * both operands contain more than KARATSUBA_CUTOFF digits (this
138 /* Allocate a new int object with size digits.
150 "too many digits in integer");
160 and the digits. */
232 /* Must be at least two digits */
302 /* Count digits (at least two - smaller cases were handled above). */
331 /* Count the number of Python digits. */ \
414 ndig = (expo-1) / PyLong_SHIFT + 1; /* Number of 'digits' in result */
822 Py_ssize_t ndigits; /* number of Python int digits */
866 /* How many Python int digits do we need? We have
882 8-bit bytes and (probably) 15-bit Python digits.*/
965 /* Copy over all the Python digits.
1129 /* Count digits (at least two - smaller cases were handled above). */
1177 /* Count the number of Python digits. */
1617 /* Divide long pin, w/ size digits, by non-zero digit n, storing quotient
1674 /* Remainder of long pin, w/ size digits, by non-zero digit n,
1747 /* quick and dirty upper bound for the number of digits
1750 #digits = 1 + floor(log2(a) / log2(_PyLong_DECIMAL_BASE))
1769 /* convert array of base _PyLong_BASE digits in pin to an array of
1770 base _PyLong_DECIMAL_BASE digits in pout, following Knuth (TAOCP,
1843 _PyLong_DECIMAL_SHIFT digits each */ \
2164 /* *str points to the first digit in a string of base `base` digits. base
2180 Py_ssize_t digits = 0;
2193 /* count digits and set p to end-of-string */
2201 ++digits;
2213 /* n <- the number of Python digits needed,
2214 = ceiling((digits * bits_per_char) / PyLong_SHIFT). */
2215 if (digits > (PY_SSIZE_T_MAX - (PyLong_SHIFT - 1)) / bits_per_char) {
2221 n = (digits * bits_per_char + PyLong_SHIFT - 1) / PyLong_SHIFT;
2339 Binary bases can be converted in time linear in the number of digits, because
2343 First some math: the largest integer that can be expressed in N base-B digits
2345 case number of Python digits needed to hold it is the smallest integer n s.t.
2355 The input string is actually treated as being in base base**i (i.e., i digits
2361 The first of these is the largest i such that i consecutive input digits
2365 Viewing the input as a sequence <c0, c1, ..., c_n-1> of digits in base
2372 Error analysis: as above, the number of Python digits `n` needed is worst-
2377 where `N` is the number of input digits in base `B`. This is computed via
2386 between the worst-case input with N digits and the smallest input with N
2387 digits is about a factor of B, but B is small compared to BASE so at most
2425 Py_ssize_t digits = 0;
2469 ++digits;
2483 if (digits > _PY_LONG_MAX_STR_DIGITS_THRESHOLD) {
2486 if ((max_str_digits > 0) && (digits > max_str_digits)) {
2488 max_str_digits, digits);
2498 double fsize_z = (double)digits * log_base_BASE[base] + 1.0;
2502 "too many digits in integer");
2515 /* `convwidth` consecutive input digits are treated as a single
2527 /* grab up to convwidth digits from the input string */
2541 * convwidth digits.
2853 at most (and usually exactly) k = size_v - size_w digits. */
2984 Number of digits needed for result: write // for floor division.
2989 digits. If shifting right, we use
2993 digits. Using a_size = 1 + (a_bits - 1) // PyLong_SHIFT along with
3458 viewing the shift as being by digits. The sign bit is ignored, and
3507 Py_ssize_t shift; /* the number of digits we split off */
3543 * b as a string of "big digits", each of width a->ob_size. That
3563 * 1. Allocate result space (asize + bsize digits: that's always
3582 /* Fill with trash, to catch reference to uninitialized digits. */
3586 /* 2. t1 <- ah*bh, and copy into high digits of result. */
3593 /* Zero-out the digits higher than the ah*bh copy. */
3599 /* 3. t2 <- al*bl, and copy into the low digits. */
3605 assert(Py_SIZE(t2) <= 2*shift); /* no overlap with high digits */
3608 /* Zero out remaining digits. */
3609 i = 2*shift - Py_SIZE(t2); /* number of uninitialized digits */
3616 i = Py_SIZE(ret) - shift; /* # digits after shift */
3676 We allocated asize + bsize result digits, and add t3 into them at an offset
3681 bh has c(bsize/2) digits, and bl at most f(size/2) digits. So bh+hl has
3682 at most c(bsize/2) digits + 1 bit.
3684 If asize == bsize, ah has c(bsize/2) digits, else ah has at most f(bsize/2)
3685 digits, and al has at most f(bsize/2) digits in any case. So ah+al has at
3686 most (asize == bsize ? c(bsize/2) : f(bsize/2)) digits + 1 bit.
3690 c(bsize/2) + (asize == bsize ? c(bsize/2) : f(bsize/2)) digits + 2 bits
3694 the question reduces to whether asize digits is enough to hold
3695 (asize == bsize ? c(bsize/2) : f(bsize/2)) digits + 2 bits. If asize < bsize,
3696 then we're asking whether asize digits >= f(bsize/2) digits + 2 bits. By #4,
3697 asize is at least f(bsize/2)+1 digits, so this in turn reduces to whether 1
3699 asize == bsize, then we're asking whether bsize digits is enough to hold
3700 c(bsize/2) digits + 2 bits, or equivalently (by #1) whether f(bsize/2) digits
3709 /* b has at least twice the digits of a, and a is big enough that Karatsuba
3711 * of slices, each with a->ob_size digits, and multiply the slices by a,
3722 Py_ssize_t nbdone; /* # of b digits already multiplied */
4061 problem since digits can hold values up to 2*PyLONG_MASK+1.
4796 In the addition `a + (2**shift - 1)`, the low `wordshift` digits of
4798 from the bottom `wordshift` digits when at least one of the least
4799 significant `wordshift` digits of `a` is nonzero. Digit `wordshift`
5039 /* Compute digits for overlap of a and b. */
5057 /* Copy any remaining digits of a, inverting if necessary. */
5161 /* reduce until a fits into 2 digits */
5774 from the first PY_SSIZE_T_MAX/PyLong_SHIFT digits can't overflow a
6113 {"default_max_str_digits", "maximum string conversion digits limitation"},