sympy/sympy — pull request #7850 by smichr (2014-08-11 03:23:46+00:00)
Title: increase evalf workprec more quickly

There were some oddities here that have been here since this code was
added. If the desired precision was not obtained, the precision appears
to want to increase in a doubling fashion based on the iteration number
but that computed value is never used by using the expression prec -
max(-2**i, accuracy)

Let's say prec was 15 but accuracy was 10 on the first iteration: the
new workprec would increase by 15 - max(-1, 10) = 5. If accuracy was 12
on the next step the new workprec would be 15 - max(-2, 12) = 3.
So the workprec is increasing but in a very slow fashion based
on the difference between the desired prec and the accuracy.

If a result of 0 was calculated, however, this would cause the working
prec to increase at a rate of prec + 1 until the maxprec was reached
because the accuracy for a scaled zero is -1. So, for example, if a value
of 0 is still being obtained when i=10 a change in prec is calculated
as 15 - max(-2**10, -1) = 16.

In both cases the value based on iteration (2**i) is being ignored.

With the changes of this commit, the larger of 2**i and prec is used as
the increment for workprec.