This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: [math] Implement pow2 function
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.8
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: mark.dickinson, nagayev, serhiy.storchaka, xtreak
Priority: normal Keywords:

Created on 2019-03-24 11:33 by nagayev, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (4)
msg338728 - (view) Author: Марат Нагаев (nagayev) * Date: 2019-03-24 11:33
Hello.
I want to implement pow2 function special for powers of 2.
pow2 works 110 times faster if we pow 4 to 10**6
pow2 implementaion on Python:
def pow2(a,b):
p=log2(a)*b
if not p.isinteger():
raise TypeError('a isn't power of 2!')
return 1«p
msg338729 - (view) Author: Марат Нагаев (nagayev) * Date: 2019-03-24 11:34
110 times is the result on MacBook 2017 13
In my phone this works 187 times faster!
msg338730 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python committer) Date: 2019-03-24 12:07
See also issue21420 in a previous attempt to optimize powers of 2 calculation in current code.
msg338792 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-03-25 08:44
See also issue31980. The objections exposed there are applicable to this issue.
History
Date User Action Args
2022-04-11 14:59:12adminsetgithub: 80596
2019-03-25 08:44:51serhiy.storchakasetstatus: open -> closed

nosy: + serhiy.storchaka
messages: + msg338792

resolution: rejected
stage: resolved
2019-03-24 12:07:29xtreaksetnosy: + xtreak
messages: + msg338730
2019-03-24 11:59:09SilentGhostsetnosy: + mark.dickinson
type: behavior
2019-03-24 11:34:18nagayevsetmessages: + msg338729
2019-03-24 11:33:10nagayevcreate