*j6. d S r SSKrSSKr SSKrSS jr\R " 5 R 5 r\R \l
\R \l \R \l S\R \R ' S rS rS rS rS rS
rS rS rS
rS rS rS rg! \ a Sr Nf = f)a Python implementations of some algorithms for use by longobject.c.
The goal is to provide asymptotically faster algorithms that can be
used for operations on integers with many digits. In those cases, the
performance overhead of the Python implementation is not significant
since the asymptotic behavior is what dominates runtime. Functions
provided by this module should be considered private and not part of any
public API.
Note: for ease of maintainability, please prefer clear code and avoid
"micro-optimizations". This module will only be imported and used for
integers with a huge number of digits. Saving a few microseconds with
tricky or non-obvious code is not worth it. For people looking for
maximum performance, they should use something like gmpy2. Nc [ 5 n[ 5 nU 1nU( a{ UR 5 n X; d X:: a M# UR U 5 U S- nUR U5 UR U5 U S- ( a UR US- 5 U( a M{ 0 nU( d U$ [ [ U5 5 n [ U 5 n
U( a [
SU
5 X- X' U H nUS-
U; a! U( a [
SU5 XS-
U- X' M- US- nX-
nXx; d eU( a [
SU5 X X - n
X:w a XS- :X d eU( a [
S5 X- n
XU' M U$ )N zpow atz * base atz square atz and * base)setpopadditersortednextprint)wbase more_thanshowseenneedwsloditfirstthishisqs ./opt/alt/python313/lib64/python3.13/_pylong.pycompute_powersr 3 sQ 5D5D
B
FFH9
!V
r
q5FF26N
" A
fTl BHE
h}AH!8q=k4(qkD(AGBB7N7k4( Bx!V|#|*+
dG' (
H r c ^^^^ SSK Jm SmUUUU4S jm[ R " [ 5 U R 5 n[ UT" S5 T5 mU S: a SnU * n OSnT" X5 nU( a U* nSSS5 U$ ! , ( d f W$ = f) z6Asymptotically fast conversion of an 'int' to Decimal.r )Decimal c | > UT:: a T" U 5 $ US- nX- nU SU- S-
- nT" XB5 T" X1U-
5 TU - - $ Nr ) nr w2r r BITLIMDinnerw2pows r r' int_to_decimal.