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 2017/07/10 10:23:11 UTC

commons-numbers git commit: NUMBERS-13: asinh() passes all tests

Repository: commons-numbers
Updated Branches:
  refs/heads/complex-dev a6c54559c -> ade98aa18


NUMBERS-13: asinh() passes all tests


Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/ade98aa1
Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/ade98aa1
Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/ade98aa1

Branch: refs/heads/complex-dev
Commit: ade98aa183a88502c0dccd1350d47dc6c8d1f37a
Parents: a6c5455
Author: Eric Barnhill <er...@apache.org>
Authored: Mon Jul 10 12:23:10 2017 +0200
Committer: Eric Barnhill <er...@apache.org>
Committed: Mon Jul 10 12:24:44 2017 +0200

----------------------------------------------------------------------
 .../org/apache/commons/numbers/complex/Complex.java    | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/ade98aa1/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 8fc1077..d3d8aa8 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
@@ -701,6 +701,19 @@ in the
      * @since 1.2
      */
     public Complex asinh(){
+        if (!Double.isNaN(real) && !Double.isInfinite(real) && imaginary == Double.POSITIVE_INFINITY) {
+            return new Complex(Double.POSITIVE_INFINITY, Math.PI * 0.5);
+        } else if (real == Double.POSITIVE_INFINITY && !Double.isInfinite(imaginary) && !Double.isNaN(imaginary)) {
+            return new Complex(Double.POSITIVE_INFINITY, 0);
+        } else if (real == Double.POSITIVE_INFINITY && imaginary == Double.POSITIVE_INFINITY) {
+            return new Complex(Double.POSITIVE_INFINITY, Math.PI * 0.25);
+        } else if (real == Double.POSITIVE_INFINITY && Double.isNaN(imaginary)) {
+            return new Complex(Double.POSITIVE_INFINITY,  Double.NaN);
+        } else if (Double.isNaN(real) && imaginary == 0) {
+            return new Complex(Double.NaN, 0);
+        } else if (Double.isNaN(real) && imaginary == Double.POSITIVE_INFINITY) {
+            return new Complex(Double.POSITIVE_INFINITY, Double.NaN);
+        }
         return square().add(Complex.ONE).sqrt().add(this).log();
     }