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 2019/09/29 01:38:20 UTC

[commons-numbers] 02/02: Named constant.

This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git

commit 85d79edf87cdbcb355a98a0d768449a62f55025b
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
AuthorDate: Sun Sep 29 03:37:37 2019 +0200

    Named constant.
---
 .../src/main/java/org/apache/commons/numbers/complex/Complex.java     | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

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 df581a9..28db64e 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
@@ -58,6 +58,8 @@ public final class Complex implements Serializable  {
     private static final double PI_OVER_2 = 0.5 * Math.PI;
     /** &pi;/4. */
     private static final double PI_OVER_4 = 0.25 * Math.PI;
+    /** "-i". */
+    private static final Complex MINUS_I = new Complex(0, -1);
 
     /** Serializable version identifier. */
     private static final long serialVersionUID = 20180201L;
@@ -1211,7 +1213,7 @@ public final class Complex implements Serializable  {
             return ONE;
         }
         if (imaginary < -20) {
-            return new Complex(0, -1);
+            return MINUS_I;
         }
 
         final double real2 = 2 * real;