hutiefang76 opened a new pull request, #336: URL: https://github.com/apache/commons-math/pull/336
CanberraDistance can return NaN for opposite finite extremes and zero for same-sign large values because intermediate arithmetic overflows. This fixes [MATH-1678](https://issues.apache.org/jira/browse/MATH-1678) by halving the coordinates only when their finite magnitudes overflow the denominator. Ordinary values and the existing NaN/infinity behavior are preserved. Regressions cover both signs, vectors, near-equal large values against an independent BigDecimal reference, subnormals and signed zero. Validation: - `mvn -B clean verify`: all 14 reactor modules completed successfully; archived Surefire results contain 3,797 tests, with 33 existing skips and no final failures/errors. - The first full run failed in the existing randomized SimplexOptimizerTest. That class also failed on an unmodified baseline. One complete rerun passed using the project's unchanged retry configuration; no tests or assertions were disabled. - A clean Java 8 build and the affected CanberraDistanceTest passed all 8 tests. The tests-only baseline reproduced 4 failures before the fix. AI assistance: DeepSeek and Codex helped implement, review and validate this patch. This description was AI-generated. -- 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. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
