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 91214200C7D for ; Tue, 2 May 2017 01:07:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8FBE4160BC5; Mon, 1 May 2017 23:07:09 +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 D6D50160BC1 for ; Tue, 2 May 2017 01:07:08 +0200 (CEST) Received: (qmail 29335 invoked by uid 500); 1 May 2017 23:07:08 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 29323 invoked by uid 99); 1 May 2017 23:07:08 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 May 2017 23:07:08 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 9888418FF52 for ; Mon, 1 May 2017 23:07:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -98.702 X-Spam-Level: X-Spam-Status: No, score=-98.702 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_NUMSUBJECT=0.5, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id fTLuPjliUbUo for ; Mon, 1 May 2017 23:07:06 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 9BDF55F642 for ; Mon, 1 May 2017 23:07:06 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id 04E21E06BF for ; Mon, 1 May 2017 23:07:06 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 0089421DE3 for ; Mon, 1 May 2017 23:07:05 +0000 (UTC) Date: Mon, 1 May 2017 23:07:05 +0000 (UTC) From: "Gilles (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Resolved] (MATH-1414) Method reciprocal() in Complex for complex numbers with parts very close to 0.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 01 May 2017 23:07:09 -0000 [ https://issues.apache.org/jira/browse/MATH-1414?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gilles resolved MATH-1414. -------------------------- Resolution: Won't Do Issue to be fixed in "Commons Numbers": see NUMBERS-22. > Method reciprocal() in Complex for complex numbers with parts very close to 0.0 > ------------------------------------------------------------------------------- > > Key: MATH-1414 > URL: https://issues.apache.org/jira/browse/MATH-1414 > Project: Commons Math > Issue Type: Improvement > Reporter: Gunel Jahangirova > Priority: Minor > Fix For: 4.0 > > > In class Complex method reciprocal() returns INF only if the real and imaginary parts are exactly equal to 0.0. In the cases when real and imaginary parts are double numbers very close to 0.0, it does not hold. For example, if we run this code > {code} > Complex complex0 = new Complex((-2.44242319E-315)); > Complex complex1 = complex0.reciprocal(); > {code} > the value of complex1.getReal() will be -Infinity and the value of complex1.getImaginary() will be NaN, instead of complex1 being equal to INF. > I think the code in the method > {code} > if (real == 0.0 && imaginary == 0.0) { > return INF; > } > {code} > should be replaced by the equality check with some tolerance (0.01 in this case): > {code} > if (equals(this, ZERO, 0.01)) { > return INF; > } > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346)