[
https://issues.apache.org/jira/browse/MATH-951?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13607849#comment-13607849
]
Charles Cooper commented on MATH-951:
-------------------------------------
It's faster because there are fewer checks and less branching. I also think it
is clearer but I'll add a comment.
> Patch: Faster implementation of double
> org.apache.commons.math3.FastMath.copySign(double, double)
> -------------------------------------------------------------------------------------------------
>
> Key: MATH-951
> URL: https://issues.apache.org/jira/browse/MATH-951
> Project: Commons Math
> Issue Type: Improvement
> Affects Versions: 3.2
> Environment: java version "1.6.0_27"
> OpenJDK Runtime Environment (IcedTea6 1.12.3) (6b27-1.12.3-1)
> OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
> Linux debian 3.2.0-4-amd64 #2 SMP Wed Jan 2 01:41:29 PST 2013 x86_64 GNU/Linux
> Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz
> Reporter: Charles Cooper
> Priority: Minor
> Labels: patch, performance
> Fix For: 3.2
>
> Attachments: patch
>
> Original Estimate: 0h
> Remaining Estimate: 0h
>
> Between 40-50% faster than both current implementation and
> java.lang.Math.copySign by my (sloppy) benchmark. Patch attached.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira