You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2018/02/01 14:08:57 UTC
[05/14] commons-numbers git commit: Unnecessary instantiations.
Unnecessary instantiations.
Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/2daea445
Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/2daea445
Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/2daea445
Branch: refs/heads/master
Commit: 2daea445e878c98fc0f0a5a90deb413813fdc8cf
Parents: 7da7fa9
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
Authored: Thu Feb 1 12:56:06 2018 +0100
Committer: Gilles Sadowski <gi...@harfang.homelinux.org>
Committed: Thu Feb 1 12:56:06 2018 +0100
----------------------------------------------------------------------
.../java/org/apache/commons/numbers/complex/Complex.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/2daea445/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 b45093d..7034f94 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
@@ -1113,7 +1113,7 @@ public class Complex implements Serializable {
* @return the square root of <code>1 - this<sup>2</sup></code>.
*/
public Complex sqrt1z() {
- return new Complex(1, 0).subtract(this.multiply(this)).sqrt();
+ return Complex.ONE.subtract(this.multiply(this)).sqrt();
}
/**
@@ -1134,7 +1134,7 @@ public class Complex implements Serializable {
*/
public Complex tan() {
if (imaginary > 20) {
- return new Complex(0, 1);
+ return Complex.ONE;
}
if (imaginary < -20) {
return new Complex(0, -1);
@@ -1167,10 +1167,10 @@ public class Complex implements Serializable {
public Complex tanh() {
if (real == Double.POSITIVE_INFINITY &&
imaginary == Double.POSITIVE_INFINITY) {
- return new Complex(1, 0);
+ return Complex.ONE;
} else if (real == Double.POSITIVE_INFINITY &&
Double.isNaN(imaginary)) {
- return new Complex(1, 0);
+ return Complex.ONE;
} else if (Double.isNaN(real) &&
imaginary == 0) {
return new Complex(Double.NaN, 0);