[
https://issues.apache.org/jira/browse/MATH-1427?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16112569#comment-16112569
]
Gilles commented on MATH-1427:
------------------------------
The "complex number" functionality is being refactored within a new project:
http://commons.apache.org/proper/commons-numbers/
You are most welcome to review the changes, currently performed within the
["complex-dev"
branch|https://git1-us-west.apache.org/repos/asf?p=commons-numbers.git;a=tree;h=0a01e2d0e7e6c6621cbf6b5c2c7da885c1691c07;hb=0a01e2d0e7e6c6621cbf6b5c2c7da885c1691c07]
and to provide suggestions on the "dev" ML.
Please report issues at
https://issues.apache.org/jira/projects/NUMBERS
> Unreachable statements in Complex.abs()
> ---------------------------------------
>
> Key: MATH-1427
> URL: https://issues.apache.org/jira/browse/MATH-1427
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.6.1
> Reporter: David Nickerson
> Priority: Minor
> Labels: easyfix, newbie, patch
> Attachments: complex_abs.patch
>
>
> This return statement in Complex.abs() is unreachable:
> {code:java}
> if (FastMath.abs(real) < FastMath.abs(imaginary)) {
> if (imaginary == 0.0) {
> return FastMath.abs(real);
> }
> {code}
> If imaginary == 0, then there's no way that the preceding condition would be
> true. There are two similar inner 'if' statements that were accidentally
> switched. Returned values are still correct, but performance suffers.
> The attached patch switches these back. Note that we're still protected from
> dividing by zero.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)