[ 
https://issues.apache.org/jira/browse/CASSANDRA-13799?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16212791#comment-16212791
 ] 

Malcolm Taylor commented on CASSANDRA-13799:
--------------------------------------------

I see that there was a test failure, sorry about that. The problem is in 
Distribution.java where the test was depending on a specific kind of floating 
point inaccuracy, and my change altered the number of iterations of the loop. 
This could be fixed by reverting the loop variable d from double back to float 
in the average() method. However, I think it would be cleaner to use an integer 
to control the loop, such as

    public long average()
    {
        double sum = 0;
        double d = 0d;
        for (int count = 0; count < 51 ; count++)
        {
            sum += inverseCumProb(d);
            d += 0.02d;
        }
        return (long) (sum / 51);
    } 

> Fix some alerts raised by lgtm.com
> ----------------------------------
>
>                 Key: CASSANDRA-13799
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13799
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Malcolm Taylor
>            Assignee: Malcolm Taylor
>             Fix For: 4.x
>
>         Attachments: 13799-trunk.txt
>
>
> lgtm.com has identified a number of issues  where there may be scope for 
> improving the code 
> ([https://lgtm.com/projects/g/apache/cassandra/alerts/?mode=tree&severity=error]).
>  This issue is to address some of the more straightforward cases.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to