Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 66BFB200CCA for ; Wed, 19 Jul 2017 16:12:19 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 653C0169112; Wed, 19 Jul 2017 14:12:19 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B388116910F for ; Wed, 19 Jul 2017 16:12:18 +0200 (CEST) Received: (qmail 66986 invoked by uid 500); 19 Jul 2017 14:12:10 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 66965 invoked by uid 99); 19 Jul 2017 14:12:09 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Jul 2017 14:12:09 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 98DC1E2F41; Wed, 19 Jul 2017 14:12:05 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ericbarnhill@apache.org To: commits@commons.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: commons-numbers git commit: NUMBERS-13: log() passes all tests Date: Wed, 19 Jul 2017 14:12:05 +0000 (UTC) archived-at: Wed, 19 Jul 2017 14:12:19 -0000 Repository: commons-numbers Updated Branches: refs/heads/complex-dev 6bf4d8b74 -> ed7525589 NUMBERS-13: log() 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/ed752558 Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/ed752558 Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/ed752558 Branch: refs/heads/complex-dev Commit: ed75255890e78d9b7ee261f7daad9b3436c74e8e Parents: 6bf4d8b Author: Eric Barnhill Authored: Wed Jul 19 16:14:04 2017 +0200 Committer: Eric Barnhill Committed: Wed Jul 19 16:14:04 2017 +0200 ---------------------------------------------------------------------- .../main/java/org/apache/commons/numbers/complex/Complex.java | 7 +++++++ 1 file changed, 7 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/ed752558/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 2a1795c..effa604 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 @@ -879,6 +879,13 @@ in the * of {@code this}. */ public Complex log() { + 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 == Double.POSITIVE_INFINITY) { + return new Complex(Double.POSITIVE_INFINITY, Double.NaN); + } return new Complex(Math.log(abs()), Math.atan2(imaginary, real)); }