Unnecessary instantiation.
Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/2af72846 Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/2af72846 Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/2af72846 Branch: refs/heads/feature__NUMBERS-51__field Commit: 2af72846f1b96315804a320f6fd95bcd5458a547 Parents: 49ed2b8 Author: Gilles Sadowski <gil...@harfang.homelinux.org> Authored: Thu Feb 1 13:11:37 2018 +0100 Committer: Gilles Sadowski <gil...@harfang.homelinux.org> Committed: Thu Feb 1 13:11:37 2018 +0100 ---------------------------------------------------------------------- .../src/main/java/org/apache/commons/numbers/complex/Complex.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/2af72846/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java ---------------------------------------------------------------------- diff --git a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java index d474c31..ca0eea8 100644 --- a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java +++ b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/Complex.java @@ -1086,7 +1086,7 @@ public class Complex implements Serializable { public Complex sqrt() { if (real == 0 && imaginary == 0) { - return new Complex(0, 0); + return ZERO; } else if (neitherInfiniteNorZeroNorNaN(real) && imaginary == Double.POSITIVE_INFINITY) { return new Complex(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);