[issue23007] Unnecessary big intermediate result in Lib/bisect.py

2014-12-11 Thread Sergey Litvinov
Sergey Litvinov added the comment: mark.dickinson do you have an example of the Lib/bisect.py code No. I was thinking about something hypothetical similar to the one you provided. rhettinger The textbook formula is more important in languages rhettinger without something like Python long ints

[issue23007] Unnecessary big intermediate result in Lib/bisect.py

2014-12-07 Thread Sergey Litvinov
New submission from Sergey Litvinov: Bisection algorithms use mid = (lo+hi)//2 Textbook formula is mid = (hi-lo)//2 + lo See http://en.wikipedia.org/w/index.php?title=Binary_search_algorithmoldid=634658510#Arithmetic For vanilla lists and integers it is not a problem but one can run