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 98157D534 for ; Fri, 24 Aug 2012 13:05:33 +0000 (UTC) Received: (qmail 82138 invoked by uid 500); 24 Aug 2012 13:05:33 -0000 Delivered-To: apmail-commons-dev-archive@commons.apache.org Received: (qmail 82025 invoked by uid 500); 24 Aug 2012 13:05:33 -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 82015 invoked by uid 99); 24 Aug 2012 13:05:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Aug 2012 13:05:32 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [193.74.71.28] (HELO sif.is.scarlet.be) (193.74.71.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Aug 2012 13:05:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scarlet.be; s=scarlet; t=1345813504; bh=z0WUfOEPqLuBtXBagZNbSuugFWOWrz9a6zMooiRZ5TU=; h=Date:From:To:Subject:Message-ID:References:MIME-Version: Content-Type:In-Reply-To; b=YKLGeJX70QVz70y3AdgWi+sEcWIz4wewF5Krl/1Z1kaitluz8+Qq3JupHN3y/BGwe tqsik7IiGrI7F/93/mGs9WP+9/0zJvO80J9VnxzzBNwmPSOl/DLqLP/ahcjHBfgooH WMIFnUfq3GFwUwJQ4dOLfSPa3eRlMymAdpiJXV2o= Received: from mail.harfang.homelinux.org (ip-62-235-198-184.dsl.scarlet.be [62.235.198.184]) by sif.is.scarlet.be (8.14.5/8.14.5) with ESMTP id q7OD533I008132 for ; Fri, 24 Aug 2012 15:05:04 +0200 X-Scarlet: d=1345813504 c=62.235.198.184 Received: from localhost (mail.harfang.homelinux.org [192.168.20.11]) by mail.harfang.homelinux.org (Postfix) with ESMTP id 61173617E4 for ; Fri, 24 Aug 2012 15:05:03 +0200 (CEST) Received: from mail.harfang.homelinux.org ([192.168.20.11]) by localhost (mail.harfang.homelinux.org [192.168.20.11]) (amavisd-new, port 10024) with ESMTP id 5DgcxM6PZ4r4 for ; Fri, 24 Aug 2012 15:05:00 +0200 (CEST) Received: from dusk.harfang.homelinux.org (mail.harfang.homelinux.org [192.168.20.11]) by mail.harfang.homelinux.org (Postfix) with ESMTP id B09876177E for ; Fri, 24 Aug 2012 15:05:00 +0200 (CEST) Received: from eran by dusk.harfang.homelinux.org with local (Exim 4.77) (envelope-from ) id 1T4tZM-00033W-Ez for dev@commons.apache.org; Fri, 24 Aug 2012 15:05:00 +0200 Date: Fri, 24 Aug 2012 15:04:59 +0200 From: Gilles Sadowski To: dev@commons.apache.org Subject: Re: [math] UnexpectedNegativeIntegerException Message-ID: <20120824130459.GK20488@dusk.harfang.homelinux.org> Mail-Followup-To: dev@commons.apache.org References: <5035DEE0.6000705@free.fr> <20120823102450.GG20488@dusk.harfang.homelinux.org> <20120823113754.GH20488@dusk.harfang.homelinux.org> <50362413.8070205@free.fr> <50367DE8.20909@gmail.com> <20120823233544.GS24856@dusk.harfang.homelinux.org> <50372DDD.2050003@free.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Tiny Tux X-PGP-Key-Fingerprint: 53B9 972E C2E6 B93C BEAD 7092 09E6 AF46 51D0 5641 User-Agent: Mutt/1.5.21 (2010-09-15) X-DCC-scarlet.be-Metrics: sif 20002; Body=1 Fuz1=1 Fuz2=1 X-Virus-Scanned: clamav-milter 0.97.1-exp at sif X-Virus-Status: Clean X-Virus-Checked: Checked by ClamAV on apache.org Hi. > > [...] > > I see that's another area where everyone has its own opinion because > of various experiences. I was previously in favor of exceptions, but > maybe it's too much for such a low-level component as a standard or > special function. So I am now convinced that NaN should be returned by > Gamma in case of invalid values. However, in the class Gamma, there > are other very low-level functions, which provide some approximations > of say Gamma(1 + x) - 1, *only in a specific range*. I believe that in > that case, an exception should be returned, as the function itself is > defined mathematically, it's only the approximation which is not > valid. I'm not so sure that an exception must be thrown. Of course the doc should say that the approximation is not valid beyond the specified range, but, since the function is defined, a user could be interested in experimenting with what happens beyond the limits. > NaN would be documented in the Javadoc. And since we are talking about > consistency, maybe it's better to be consistent with standard > functions, which do not raise exceptions but return NaNs instead. Maybe, but this only states that we want consistency with "something" (in this case, the behaviour of the functions of the standard Java Math class). It doesn't say why it is useful to return NaNs. We have thus a case where consistency is deemed good for its own sake. The same should hold for the code formatting issue. Regards, Gilles --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org For additional commands, e-mail: dev-help@commons.apache.org