commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Luc Maisonobe (JIRA)" <>
Subject [jira] Commented: (MATH-375) Elementary functions in JDK are slower than necessary and not as accurate as they could be.
Date Sun, 29 Aug 2010 22:17:55 GMT


Luc Maisonobe commented on MATH-375:

The FastMath class has been added to the subversion repository, as of r990655 for branch 2.X
and as r990658 for trunk.
It is now used everywhere in the library (including in tests), in replacement of java.util.Math.
The contributed patch has been edited to match commons-math coding style which is enforced
by checkstyle. The corresponding changes are mainly basic formatting (spaces, braces ...),
naming conventions, variables declarations on separate lines, javadoc everywhere ... Some
javadoc have been marked as "To Be Confirmed" (exp and log), please have a llook at it and
check if they are correct.
In order to let users do global search and replace of java.util.Math by the new class, several
new methods have been added. For the new functions (sinh, cosh ...) basic implementations
have been set up. These implementations should be about 3 ULP accurate and may be slow for
now. For consistency, the inverse hyperbolic functions (asinh, acosh and atanh) have been
added too, depite they are not present in java.util.Math.
The unit tests have not been committed to the subversion repository yet, we are waiting for
the dfp library to be available and integrated too (otherwise the continuous integration process
would be broken by the missing dependency). This issue will be marked as resolved when the
tests will be committed.

Thanks again for this contribution.

> Elementary functions in JDK are slower than necessary and not as accurate as they could
> -------------------------------------------------------------------------------------------
>                 Key: MATH-375
>                 URL:
>             Project: Commons Math
>          Issue Type: New Feature
>         Environment: JDK 1.4 - 1.6
>            Reporter: William Rossi
>             Fix For: 2.2
>         Attachments: atanpatch.txt.gz, FastMath.tar.gz
> I would like to contribute improved versions on exp(), log(), pow(), etc.  to the project.
 Please refer to this discussion thread
> I have developed over the past year a set of elementary functions similar to those in
java.lang.Math, but with the following characteristics:
> * Higher performance.
> * Better accuracy.  Results are accurate to slightly more that +/- 0.5 ULP.
> * Pure Java.  The standard Math class is impleneted via JNI, and thus takes a performance
> Note that some functions such as exp are nearly twice as fast in my implementation.  
I've seen it 3 times faster on different processors.   The preformance varies by the relative
speed of calculation vs memory lookups.
> The functions are implemented as tables of values in extra precision (approx 70 bits),
and then interpolated with a minimax polynomial.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message