Return-Path: X-Original-To: apmail-commons-dev-archive@www.apache.org Delivered-To: apmail-commons-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C73E89FCA for ; Fri, 13 Apr 2012 15:30:37 +0000 (UTC) Received: (qmail 14369 invoked by uid 500); 13 Apr 2012 15:30:37 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 14264 invoked by uid 500); 13 Apr 2012 15:30:36 -0000 Mailing-List: contact dev-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Developers List" Delivered-To: mailing list dev@commons.apache.org Received: (qmail 14254 invoked by uid 99); 13 Apr 2012 15:30:36 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Apr 2012 15:30:36 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=5.0 tests=RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of SRS0=gwVt=CT=m4x.org=sebastien.brisard@bounces.m4x.org designates 129.104.30.34 as permitted sender) Received: from [129.104.30.34] (HELO mx1.polytechnique.org) (129.104.30.34) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Apr 2012 15:30:27 +0000 Received: from mail-vb0-f43.google.com (mail-vb0-f43.google.com [209.85.212.43]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by ssl.polytechnique.org (Postfix) with ESMTPSA id C15091407BB65 for ; Fri, 13 Apr 2012 17:30:06 +0200 (CEST) Received: by vbbfq11 with SMTP id fq11so2569802vbb.30 for ; Fri, 13 Apr 2012 08:30:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.180.38 with SMTP id dl6mr760213vdc.105.1334331005827; Fri, 13 Apr 2012 08:30:05 -0700 (PDT) Received: by 10.52.26.241 with HTTP; Fri, 13 Apr 2012 08:30:05 -0700 (PDT) In-Reply-To: References: Date: Fri, 13 Apr 2012 17:30:05 +0200 Message-ID: Subject: Re: [math] Is overflow dealt with properly in Dfp? From: =?ISO-8859-1?Q?S=E9bastien_Brisard?= To: Commons Developers List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-AV-Checked: ClamAV using ClamSMTP at svoboda.polytechnique.org (Fri Apr 13 17:30:07 2012 +0200 (CEST)) X-Org-Mail: sebastien.brisard.1997@polytechnique.org X-Old-Spam-Flag: No, tests=bogofilter, spamicity=0.000019, queueID=09D231407BB68 Hello, > >> I'm currently working on MATH-753, and the underlying accuracy issues. >> I therefore implemented the Gamma function for Dfps, and came accross >> a few strange things. For example, althoug the javadoc states that the >> maximum exponent is 32768, there is no systematic check on this limit. >> I suppose overflow should happen in the following case >> {code} >> =A0 =A0DfpField field =3D new DfpField(40); >> =A0 =A0final Dfp x =3D field.getOne().power10K(Integer.MAX_VALUE); >> =A0 =A0System.out.println(x); >> =A0 =A0System.out.println(x.isInfinite()); >> {code} >> >> Instead, what happens is >> {console} >> 1.000000000000000000000000000000000000e-4 >> false >> {console} >> >> The surprising answer comes from the fact that power10K actually >> increments its integer argument. I do not think the above printout is >> the expected behavior, am I wrong? I think this is potentially a vast >> issue, because a quick check seems to indicate that "this.nans =3D=3D >> INFINITE" is often checked in class Dfp, but I don't think the >> statement "this.nans =3D INFINITE" ever occurs, which would mean that >> overflow is never dealt with properly. Again, I'm probably wrong, I'd >> like to have the feeling of someone more used to this class than I am. > > > I obviously agree this result is wrong ... > > Is William (the creator of both Dfp and FastMath) still around to deal wi= th > this issue ? > I'm afraid he probably is not... I feel like walking on eggs on this issue, because I'm not yet fully familiar with the Dfp class. If everyone agrees, I'll wait a little bit before I file a bug report. S=E9bastien --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org