From issues-return-75995-archive-asf-public=cust-asf.ponee.io@commons.apache.org Tue Jun 25 09:08:02 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id F210018062F for ; Tue, 25 Jun 2019 11:08:01 +0200 (CEST) Received: (qmail 10396 invoked by uid 500); 25 Jun 2019 09:08:01 -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 10383 invoked by uid 99); 25 Jun 2019 09:08:01 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Jun 2019 09:08:01 +0000 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 B16B4E2DF3 for ; Tue, 25 Jun 2019 09:08:00 +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 64D6E25816 for ; Tue, 25 Jun 2019 09:08:00 +0000 (UTC) Date: Tue, 25 Jun 2019 09:08:00 +0000 (UTC) From: "Heinrich Bohne (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (NUMBERS-119) BigFraction(double) constructor does not treat subnormal numbers correctly MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/NUMBERS-119?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D168= 72173#comment-16872173 ]=20 Heinrich Bohne commented on NUMBERS-119: ---------------------------------------- About the code coverage decrease in the method {{reduce()}} caused by PR #5= 6 (the coverage decrease in {{ArithmeticUtils}} is a myth invented by Cover= alls, my IDE even shows that the condition in line 112 is always false): Since the local variable {{k}} had to be set inside the conditional tree th= at depends on the value of the exponent rather than outside it as was previ= ously the case, I thought I would also make a special case for zero, becaus= e it doesn't make sense for the denominator of a zero-fraction to be 2=EF= =BB=BF^1074^. It didn't occur to me that this would have an effect on the c= ode coverage. However, with this change, the uncovered line in the method {{reduce()}} be= comes unreachable, because the zero fraction created from this double const= ructor was the only case where the fraction was not already reduced to lowe= st terms. This renders the {{reduce()}} method obsolete anyway, which could= be the target of a new JIRA ticket. > BigFraction(double) constructor does not treat subnormal numbers correctl= y > -------------------------------------------------------------------------= - > > Key: NUMBERS-119 > URL: https://issues.apache.org/jira/browse/NUMBERS-119 > Project: Commons Numbers > Issue Type: Bug > Components: fraction > Affects Versions: 1.0 > Reporter: Heinrich Bohne > Priority: Minor > Time Spent: 1h > Remaining Estimate: 0h > > The constructor {{BigFraction(double)}} does not take into account the fa= ct that, when the biased exponent of a {{double}} value is {{0}} and the ma= ntissa is not {{0}} (i.e. when the value represents a subnormal number), th= e actual exponent in effect is not {{-1023}} but {{-1022}} (or, in other wo= rds, the effective exponent bias is not {{1023}} but {{1022}}). > The value of the created {{BigFraction}} is therefore not equal to the va= lue of the passed {{double}} argument. -- This message was sent by Atlassian JIRA (v7.6.3#76005)