Message252985
Int to decimal string conversion (function long_to_decimal_string_internal() at Objects/longobject.c:1583) has a limitation. On 32-bit platform you can't convert integers larger than 2**2**31 (10**646456993). Proposed patch removes this limitation [*].
It also decreases memory requirements for intermediate buffer on 10%. The size of intermediate buffer (in digits) depends on the size of the integer. Unpatched:
For 15-bit digits: size*15/4/3 = size*1.25
For 30-bit digits: size*30/9/3 = size*1.11
Patched:
For 15-bit digits: size*15/4/3.3 = size*1.14
For 30-bit digits: size*30/9/3.3 = size*1.01
[*] Converting such large integers to decimal string can be not finished for reasonable time, because it has quadratic complexity. On my netbook the estimated time of calculating str(2**2**31) is 5 years. But this is different issue. |
|
| Date |
User |
Action |
Args |
| 2015-10-14 11:42:43 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, mark.dickinson |
| 2015-10-14 11:42:43 | serhiy.storchaka | set | messageid: <1444822963.9.0.112952407665.issue25402@psf.upfronthosting.co.za> |
| 2015-10-14 11:42:43 | serhiy.storchaka | link | issue25402 messages |
| 2015-10-14 11:42:43 | serhiy.storchaka | create | |
|