Closed Nogi-v-Ruki closed 1 year ago
Oopse! It seems that gmpy2.popcount(number) does the wanted action. Probably, just ReadTheDocs needs some update.
FYI, gmpy2 2.1.5 is available via pip.
C:\Users\User>py -3.10 -m pip install gmpy2
Collecting gmpy2
Downloading gmpy2-2.1.5-cp310-cp310-win_amd64.whl (1.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 7.0 MB/s eta 0:00:00
Installing collected packages: gmpy2
Successfully installed gmpy2-2.1.5
bit_count
and popcount
are both available in 2.1.5.
>>> import gmpy2
>>> gmpy2.version()
'2.1.5'
>>> gmpy2.mpz(1234).bit_count()
5
>>> gmpy2.bit_count(1234)
5
>>> gmpy2.popcount(1234)
5
Can you try upgrading via pip install --upgrade gmpy2
?
Hi! «pip install --upgrade gmpy2» worked fine! both n.bit_count() and gmpy2.bit_count(n) are available. Thanks for your invaluable efforts! Best regards! Albert Kiselev aka @.***
Воскресенье, 25 июня 2023, 22:52 +07:00 от casevh @.***>: FYI, gmpy2 2.1.5 is available via pip. C:\Users\User>py -3.10 -m pip install gmpy2 Collecting gmpy2 Downloading gmpy2-2.1.5-cp310-cp310-win_amd64.whl (1.1 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 7.0 MB/s eta 0:00:00 Installing collected packages: gmpy2 Successfully installed gmpy2-2.1.5
bit_count and popcount are both available in 2.1.5.
import gmpy2 gmpy2.version() '2.1.5' gmpy2.mpz(1234).bit_count() 5 gmpy2.bit_count(1234) 5 gmpy2.popcount(1234) 5
Can you try upgrading via pip install --upgrade gmpy2? — Reply to this email directly, view it on GitHub , or unsubscribe . You are receiving this because you modified the open/close state. Message ID: <aleaxit/gmpy/issues/416/1606140709 @ github . com>
Hi! @Python 3.10 gmpy2 2.1.2 (latest available with pip install) @Win10 x64 there is no method/function .bit_count(): neither as gmpy2.bit_count(number) => "AttributeError: module 'gmpy2' has no attribute 'bit_count'" nor as number.bit_count() => "AttributeError: 'mpz' object has no attribute 'bit_count'" Thank you!