In the following code, the evalf prints -32.16...
restart; S := 8;
sigma := 8/sqrt(2*Pi);
iprec := 151;
evalf(log(-(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(log(....)), and re-run *just that line*. It now prints -66.67...
Change the last line to evalf(log(...)) 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 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?