commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Neidhart>
Subject Re: apache commons math and FastMath
Date Thu, 21 Feb 2013 21:24:06 GMT
On 02/21/2013 09:38 PM, Jeff Hain wrote:
> Hi.
> Posted perf considerations in
> as Gilles advised.

Hi Jeff,

thanks for that.

I move the conversation to the public mailing list.

> I didn't mention accuracy problems as the issue is just about perf,
> but in the attached file you can find the output of FastMathTest
> which shows some problematic cases (each test method abording on
> first accuracy-failure).
> I let you create an issue for it.
> My tests just compare against StrictMath (and with Jafama's epsilons;
> you might want to use 1e-15 everywhere instead), so if you think StrictMath
> doesn't give most-accurate results, it can just help find crazy cases.

Accuracy problems, especially for corner cases are of interest, and we
should aim to fix them. In case you do not know yet, but in commons-math
we do have an arbitrary precision arithmetic implementation (Dfp), which
is also used to validate CM FastMath with StrictMath (and StrictMath is
not considered to be perfectly accurate, this a difference between CM
FastMath <-> StrictMath does not
automatically imply that CM FastMath is wrong or less accurate).

We do not yet test for the full range of possible inputs, which is quite
tricky and there exists an issue for it (MATH-580).

> What I'm worried about is that if FastMath can go crazy for so many cases,
> I don't see how we could consider it to be more accurate than StrictMath.
> I don't have references other than StrictMath result, so the best I could
> think of, is a plain-java implementation that would give the same results
> than StrictMath, and be faster when JIT-optimized, but I think among the
> 2 or 3 people on Earth (ok, maybe a bit more :) that would need that,
> all of them should be able to roll out their own classes - or just take
> one more coffee while StrictMath does the job :)

This has to be analyzed in more detail imho.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message