Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 2DCB3D49B for ; Tue, 31 Jul 2012 13:11:37 +0000 (UTC) Received: (qmail 65148 invoked by uid 500); 31 Jul 2012 13:11:36 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 65032 invoked by uid 500); 31 Jul 2012 13:11:36 -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 64830 invoked by uid 99); 31 Jul 2012 13:11:36 -0000 Received: from issues-vm.apache.org (HELO issues-vm) (140.211.11.160) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 31 Jul 2012 13:11:36 +0000 Received: from isssues-vm.apache.org (localhost [127.0.0.1]) by issues-vm (Postfix) with ESMTP id 066821404B4 for ; Tue, 31 Jul 2012 13:11:35 +0000 (UTC) Date: Tue, 31 Jul 2012 13:11:34 +0000 (UTC) From: "Baste Nesse Buanes (JIRA)" To: issues@commons.apache.org Message-ID: <613923826.121252.1343740296029.JavaMail.jiratomcat@issues-vm> In-Reply-To: <897091632.121250.1343740175730.JavaMail.jiratomcat@issues-vm> Subject: [jira] [Updated] (MATH-835) Fraction percentageValue rare overflow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/MATH-835?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Baste Nesse Buanes updated MATH-835: ------------------------------------ Attachment: percentageValueOverflow.patch > Fraction percentageValue rare overflow > -------------------------------------- > > Key: MATH-835 > URL: https://issues.apache.org/jira/browse/MATH-835 > Project: Commons Math > Issue Type: Bug > Affects Versions: 3.0 > Reporter: Baste Nesse Buanes > Priority: Minor > Attachments: percentageValueOverflow.patch > > > The percentageValue() method of the Fraction class works by first multiplying the Fraction by 100, then converting the Fraction to a double. This causes overflows when the numerator is greater than Integer.MAX_VALUE/100, even when the value of the fraction is far below this value. > The patch changes the method to first convert to a double value, and then multiply this value by 100 - the result should be the same, but with less overflows. An addition to the test is also included. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira