You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/10/28 00:02:00 UTC

[jira] [Work logged] (MATH-1559) testCreateFromDoubles can fail

     [ https://issues.apache.org/jira/browse/MATH-1559?focusedWorklogId=505466&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-505466 ]

ASF GitHub Bot logged work on MATH-1559:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 28/Oct/20 00:01
            Start Date: 28/Oct/20 00:01
    Worklog Time Spent: 10m 
      Work Description: tongxin97 opened a new pull request #162:
URL: https://github.com/apache/commons-math/pull/162


   For detailed description of the issue, see: https://issues.apache.org/jira/browse/MATH-1559
   
   If we just want to change the test so that it will always pass, this PR achieves it by setting a small epsilon (1e-15) in `assertEquals(0.5, distribution.probability(2), 1e-15)`. Otherwise to fix the issue, the source code, in particular `MathArrays.normalizeArray()` needs change.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

            Worklog Id:     (was: 505466)
    Remaining Estimate: 0h
            Time Spent: 10m

> testCreateFromDoubles can fail
> ------------------------------
>
>                 Key: MATH-1559
>                 URL: https://issues.apache.org/jira/browse/MATH-1559
>             Project: Commons Math
>          Issue Type: Bug
>    Affects Versions: 3.6.1
>            Reporter: XinT
>            Priority: Minor
>              Labels: pull-request-available, test
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> EnumeratedRealDistributionTest.testCreateFromDoubles() can sometimes fail due to a precision problem. More precisely, sometimes distribution.probability(2) equals to 0.5000000000000001, and the assertion assertEquals(0.5, distribution.probability(2), 0) will fail. 
> The deeper reason why this happens is that the call to MathArrays.normalizeArray() in the constructor of EnumeratedDistribution (line 105) can mess up the probability for value 2 by changing it from exactly 0.5 to 0.5000000000000001. 
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)