[Python-checkins] r46846 - sandbox/trunk/decimal-c/_decimal.c
mateusz.rukowicz
python-checkins at python.org
Sun Jun 11 03:08:41 CEST 2006
Author: mateusz.rukowicz
Date: Sun Jun 11 03:08:39 2006
New Revision: 46846
Modified:
sandbox/trunk/decimal-c/_decimal.c
Log:
Some minor changes.
Modified: sandbox/trunk/decimal-c/_decimal.c
==============================================================================
--- sandbox/trunk/decimal-c/_decimal.c (original)
+++ sandbox/trunk/decimal-c/_decimal.c Sun Jun 11 03:08:39 2006
@@ -3120,8 +3120,9 @@
buf[0] = (self->sign & 1 ? '-' : '+');
for (i = 0; i < max; i++) {
if (i < self->ob_size)
- buf[i+1] = self->digits[i] + 48;
- else
+// buf[i+1] = self->digits[i] + 48;
+ buf[i+1] = _limb_get_digit(self->limbs, self->ob_size, i) + '0'; /* SLOW */
+ else
buf[i+1] = '0';
}
buf[max+1] = 0;
@@ -3163,8 +3164,9 @@
for (i = 0; i < max; i++) {
if (i < self->ob_size)
- res = res * 10 + self->digits[i];
- else
+// res = res * 10 + self->digits[i];
+ res = res * 10 + _limb_get_digit(self->limbs, self->ob_size, i); /* SLOW */
+ else
res *= 10;
}
if (self->sign & 1) res = -res;
@@ -4018,7 +4020,7 @@
tup = PyTuple_New(self->ob_size);
if (!tup) return NULL;
for (i = 0; i < self->ob_size; i++)
- PyTuple_SET_ITEM(tup, i, PyInt_FromLong(self->digits[i]));
+ PyTuple_SET_ITEM(tup, i, PyInt_FromLong(_limb_get_digit(self->limbs, self->ob_size, i))); /* SLOW */
return tup;
}
@@ -5090,6 +5092,7 @@
&pyignored))
return NULL;
+
if (pytraps == NULL) {
_traps = PyDict_Copy(PyDecimal_DefaultContext->traps);
if (!_traps) goto err;
@@ -5201,8 +5204,9 @@
else
capitals = capitals & 1;
- if (rounding_dec == -1)
- rounding_dec = PyDecimal_DefaultContext->rounding_dec;
+// if (rounding_dec == -1)
+ if(rounding_dec != NEVER_ROUND && rounding_dec != ALWAYS_ROUND) /* XXX????*/
+ rounding_dec = PyDecimal_DefaultContext->rounding_dec;
if (rounding_dec != NEVER_ROUND && rounding_dec != ALWAYS_ROUND) {
PyErr_SetString(PyExc_ValueError, "_rounding_decision must be one of "
More information about the Python-checkins
mailing list