New issue 219 by smi...@gmail.com: giant_steps
http://code.google.com/p/mpmath/issues/detail?id=219
What steps will reproduce the problem?
1. giant_steps(1, 100)
What is the expected output?
[4, 5, 7, 10, 16, 28, 52, 100]
What do you see instead?
hangs
What version of the product are you using? On what operating system?
0.17
Please provide any additional information below.
The following may be a more robust code for that routine:
L = [target]
while 1:
Li = L[-1]//n + 2
if Li >= L[-1]:
break
L.append(Li)
return L[::-1]
I guess `if Li >= L[-1] or Li < start` would be better for the break
condition.
I don't see much need to change this function, as it's really only intended
internally for numerical Newton iteration where the starting precision is
much higher than 1.
For algebraic Newton iteration, where the starting precision might be 1, it
is better to use a more exact version, precisely doing ceiling divisions by
n.
The proposed change would not really be correct anyway as it should start
with something like 1, 2, 3, ...
OK. And it only hangs if you happen to start at 1. Since it wasn't a
private function it caught my attention.