In our test system, for the difference between two floating-point numbers
we use the test
abs(expr1-expr2) < 2 * 10^(no_digits(max(abs(expr1), abs(expr2)))-16)
no_digits(x) := if x = 0 then 0 else entier(log(x)/log(10)) + 1$
which worked until now, but it might be too harsh.
On the other hand, the difference of
4.830986538632788-4.83098653863282 ~ -3.197442310920451e-14
is gigantic (so well, at least to me ;-)) ?
The question is what would be a reasonable number instead of "2" above?
Any idea?
> > 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.
Aha, thus it got slower. So well, it seems we need to lower our
expectations for some time ...
Oliver
--
Dr. Oliver Kullmann
Computer Science Department
Swansea University
Faraday Building, Singleton Park
Swansea SA2 8PP, UK
http://cs.swan.ac.uk/~csoliver/