commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aherb...@apache.org
Subject [commons-numbers] 01/07: Consistent error handling between asin and acos.
Date Sun, 29 Dec 2019 22:05:58 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 261b7e701f7eadaa73969f3fa5bd7bff37d68b92
Author: Alex Herbert <aherbert@apache.org>
AuthorDate: Sat Dec 28 01:08:27 2019 +0000

    Consistent error handling between asin and acos.
---
 .../src/main/java/org/apache/commons/numbers/complex/Complex.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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 0ddddf4..01f87cd 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
@@ -1587,11 +1587,11 @@ public final class Complex implements Serializable  {
                     im = Math.log(a + Math.sqrt(a * a - 1));
                 }
             } else {
-                // Hull et al: Exception handling code from figure 3
+                // Hull et al: Exception handling code from figure 4
                 if (y <= (Precision.EPSILON * Math.abs(xm1))) {
                     if (x < 1) {
                         re = Math.asin(x);
-                        im = y / Math.sqrt(-xp1 * xm1);
+                        im = y / Math.sqrt(xp1 * (1 - x));
                     } else {
                         re = PI_OVER_2;
                         if ((Double.MAX_VALUE / xp1) > xm1) {


Mime
View raw message