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 20CC6200C73 for ; Wed, 26 Apr 2017 00:32:09 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 1F7EC160BB8; Tue, 25 Apr 2017 22:32: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 6DC94160BB3 for ; Wed, 26 Apr 2017 00:32:08 +0200 (CEST) Received: (qmail 37886 invoked by uid 500); 25 Apr 2017 22:32:07 -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 37875 invoked by uid 99); 25 Apr 2017 22:32:07 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Apr 2017 22:32:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 0F0B8C7E05 for ; Tue, 25 Apr 2017 22:32:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-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-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id lMsHbCdV7oHE for ; Tue, 25 Apr 2017 22:32:06 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id CC2105FCE8 for ; Tue, 25 Apr 2017 22:32:05 +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 CDB98E0BE1 for ; Tue, 25 Apr 2017 22:32:04 +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 3C45B21D97 for ; Tue, 25 Apr 2017 22:32:04 +0000 (UTC) Date: Tue, 25 Apr 2017 22:32:04 +0000 (UTC) From: "Eric Barnhill (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (NUMBERS-22) 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: Tue, 25 Apr 2017 22:32:09 -0000 [ https://issues.apache.org/jira/browse/NUMBERS-22?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15983762#comment-15983762 ] Eric Barnhill commented on NUMBERS-22: -------------------------------------- I am indeed in the middle of coding a large test class that will enforce all the ISO C standards on the complex number trigonometric operations. Thank you for bringing this to my attention and I will make sure it is enforced in testing as well. This can be assigned to me. > Method reciprocal() in Complex for complex numbers with parts very close to 0.0 > ------------------------------------------------------------------------------- > > Key: NUMBERS-22 > URL: https://issues.apache.org/jira/browse/NUMBERS-22 > Project: Commons Numbers > Issue Type: Improvement > Reporter: Gunel Jahangirova > Priority: Minor > > I have been redirected here from the issue repository of Apache Commons Math, as the Complex class will likely be deprecated in favour of its equivalent in "Commons Numbers". > 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. > The suggested solutions after the discussion are either checking the equality to ZERO with some tolerance or to detect if one of the real or imaginary parts is going to be infinite or NaN and then return the proper result. -- This message was sent by Atlassian JIRA (v6.3.15#6346)