[ https://issues.apache.org/jira/browse/STATISTICS-72?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17745297#comment-17745297 ]
Alex Herbert commented on STATISTICS-72: ---------------------------------------- The current implementation uses Math.min. This correctly orders -0.0 and 0.0, and assigns an ordering to NaN. The alternative is to use the less-than operator for a single conditional: {{{}min = x < min ? x : min{}}}. Note however that Math.min is an intrinsic from JDK 11 onwards which will make the performance gap smaller between the two methods. The worst case scenario is to find the min of an array of (mainly) zeros. A quick test in JMH with arrays randomly populated with different amounts of zeros will be able to see if it worth pursuing the simple alternative. The random use of zero or not will prevent branch prediction optimising the code path. > Implement Min > ------------- > > Key: STATISTICS-72 > URL: https://issues.apache.org/jira/browse/STATISTICS-72 > Project: Commons Statistics > Issue Type: Sub-task > Components: descriptive > Reporter: Anirudh Joshi > Assignee: Anirudh Joshi > Priority: Minor > Labels: gsoc, gsoc2023 > Fix For: 1.1 > > > Logic to compute the minimum of all values seen so far. -- This message was sent by Atlassian Jira (v8.20.10#820010)