[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    [jira] [Commented] (MATH-1196) FastMath.round (like Math.round) returns surprising results for some 
From:       "Phil Steitz (JIRA)" <jira () apache ! org>
Date:       2015-12-29 21:31:49
Message-ID: JIRA.12768233.1421517102000.24239.1451424709869 () Atlassian ! JIRA
[Download RAW message or body]


    [ https://issues.apache.org/jira/browse/MATH-1196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15074323#comment-15074323 \
] 

Phil Steitz commented on MATH-1196:
-----------------------------------

The patch makes sense to me.  Assuming current and tests above pass, +1 to commit, \
adding (at least) test case above. 

> FastMath.round (like Math.round) returns surprising results for some arguments
> ------------------------------------------------------------------------------
> 
> Key: MATH-1196
> URL: https://issues.apache.org/jira/browse/MATH-1196
> Project: Commons Math
> Issue Type: Bug
> Affects Versions: 3.4.1
> Reporter: Phil Steitz
> Attachments: MATH-1196.patch
> 
> 
> The first assertion in the test case below succeeds, but the second fails
> {code}
> /*
> * http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6430675
> */
> @Test
> public void testRoundDown() {
> final double x = 0x1.fffffffffffffp-2;
> Assert.assertTrue(x < 0.5d);
> Assert.assertEquals(0, FastMath.round(x));
> }
> {code}
> This is being tracked as a JDK (actually spec) bug here:
> http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6430675



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic