On 12/27/10 2:49 PM, Oliver Kullmann wrote:
>
> I actually did some initial experiments then, but they didn't give a clear
> picture. So well, I started some first new experiments ("21" refers to 5.21.1,
> ""22" to 5.22.1):
>
> testf1(n) := float(apply("+",create_list(log(i)*(-1)^i,i,1,n)));
> testf1c(n):=block([fpprec:30],bfloat(apply("+",create_list(log(i)*(-1)^i,i,1,n))));
> testf1f(n) := apply("+",create_list(float(log(i))*(-1)^i,i,1,n));
>
> 21:
>
> (%i24) testf1(10000);
> Evaluation took 79.0520 seconds (125.7410 elapsed)
> (%o24) 4.830986538632788
>
[snip]
> 22:
>
> (%i19) testf1(10000);
> Evaluation took 68.2900 seconds (123.3390 elapsed)
> (%o19) 4.83098653863282
>
> The deviation for n=10000 of testf1(n) seems quite big.
You mean the difference of between 4.830986538632788 and
4.83098653863282? That doesn't seem so large to me, but I would have
expected them to be the same. It might take some time to figure out why
the results are different, but my guess would be the change in how
float(log(n)) is computed.
In 5.21, it just called cl:log to compute the result. In 5.22, the
method was changed to allow computing float(log(<really big integer or
rational>)). For ecl and gcl, this results in the computation of two
logs and their sum, which could account for the difference. On other
lisps, we just try log first and if it signals an error, we use the new
method.
Ray