Question: Evalf precision incorrect

In the following code, the evalf prints -32.16... 

restart; S := 8;

sigma := 8/sqrt(2*Pi);

iprec := 151;

evalf(log[2](-(sum(log(round(2^iprec*exp(-j^2/(2*sigma^2)))/2^iprec*exp(-j^2/(2*sigma^2))))*round(2^iprec*exp(-j^2/(2*sigma^2)))/2^iprec, j = 0 .. 7))));


Change the last line to evalf[20](log[2](....)), and re-run *just that line*. It now prints -66.67...

Change the last line to evalf[200](log[2](...)) and re-run *just that line* again. It now prints -151.24... (I have strong evidence to support that the true value is near -151, so I believe this answer.)

Now remove the precision indicator from the command completely and re-run just the last line. It *still* prints -151.24...!


My two questions are: why do I need evalf[200] to get the first three digits of the answer to be correct? and why does setting the evalf precision and then removing it cause the previous precision to persist?

Please Wait...