Lines Matching refs:ndigits
155 Py_ssize_t ndigits = size ? size : 1;
162 ndigits*sizeof(digit));
235 Py_ssize_t ndigits = 2;
237 ++ndigits;
240 PyLongObject *v = _PyLong_New(ndigits);
243 Py_SET_SIZE(v, ndigits * sign);
292 int ndigits;
306 ndigits = 2;
308 ++ndigits;
313 v = _PyLong_New(ndigits);
316 Py_SET_SIZE(v, ival < 0 ? -ndigits : ndigits);
332 Py_ssize_t ndigits = 0; \
335 ++ndigits; \
338 PyLongObject *v = _PyLong_New(ndigits); \
789 Py_ssize_t ndigits;
794 ndigits = Py_ABS(Py_SIZE(v));
795 assert(ndigits == 0 || v->ob_digit[ndigits - 1] != 0);
796 if (ndigits > 0) {
797 digit msd = v->ob_digit[ndigits - 1];
798 if ((size_t)(ndigits - 1) > SIZE_MAX / (size_t)PyLong_SHIFT)
800 result = (size_t)(ndigits - 1) * (size_t)PyLong_SHIFT;
822 Py_ssize_t ndigits; /* number of Python int digits */
875 ndigits = (numsignificantbytes * 8 + PyLong_SHIFT - 1) / PyLong_SHIFT;
876 v = _PyLong_New(ndigits);
905 assert(idigit < ndigits);
915 assert(idigit < ndigits);
931 Py_ssize_t ndigits; /* |v->ob_size| */
943 ndigits = -(Py_SIZE(v));
952 ndigits = Py_SIZE(v);
969 assert(ndigits == 0 || v->ob_digit[ndigits - 1] != 0);
974 for (i = 0; i < ndigits; ++i) {
988 if (i == ndigits - 1) {
1119 int ndigits;
1133 ndigits = 2;
1135 ++ndigits;
1140 v = _PyLong_New(ndigits);
1143 Py_SET_SIZE(v, ival < 0 ? -ndigits : ndigits);
1161 int ndigits = 0;
1180 ++ndigits;
1183 v = _PyLong_New(ndigits);
1186 Py_SET_SIZE(v, negative ? -ndigits : ndigits);
5582 ndigits as o_ndigits: object = NULL
5587 Rounding with an ndigits argument also returns an integer.
5594 PyObject *temp, *result, *ndigits;
5613 ndigits = _PyNumber_Index(o_ndigits);
5614 if (ndigits == NULL)
5617 /* if ndigits >= 0 then no rounding is necessary; return self unchanged */
5618 if (Py_SIZE(ndigits) >= 0) {
5619 Py_DECREF(ndigits);
5623 /* result = self - divmod_near(self, 10 ** -ndigits)[1] */
5624 temp = long_neg((PyLongObject*)ndigits);
5625 Py_DECREF(ndigits);
5626 ndigits = temp;
5627 if (ndigits == NULL)
5632 Py_DECREF(ndigits);
5636 temp = long_pow(result, ndigits, Py_None);
5637 Py_DECREF(ndigits);
5692 Py_ssize_t ndigits;
5699 ndigits = Py_ABS(Py_SIZE(self));
5700 if (ndigits == 0)
5703 msd = ((PyLongObject *)self)->ob_digit[ndigits-1];
5706 if (ndigits <= PY_SSIZE_T_MAX/PyLong_SHIFT)
5707 return PyLong_FromSsize_t((ndigits-1)*PyLong_SHIFT + msd_bits);
5710 result = (PyLongObject *)PyLong_FromSsize_t(ndigits - 1);
5770 Py_ssize_t ndigits = Py_ABS(Py_SIZE(z));
5776 Py_ssize_t ndigits_fast = Py_MIN(ndigits, PY_SSIZE_T_MAX/PyLong_SHIFT);
5787 for (Py_ssize_t i = ndigits_fast; i < ndigits; i++) {