You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2021/06/09 23:56:21 UTC

[commons-numbers] 05/05: Call L2.of(double, double) not L2.of(double[])

This is an automated email from the ASF dual-hosted git repository.

aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-numbers.git

commit 9b67b8e6890a47dcfc26388da2b4ee03758a9a94
Author: Alex Herbert <ah...@apache.org>
AuthorDate: Thu Jun 10 00:50:19 2021 +0100

    Call L2.of(double, double) not L2.of(double[])
    
    When using L2.of(double[]) the testEuclidean_2d_vsHypot test fails. This
    may be due to the lack of ordering in the computation for the array
    method.
---
 .../src/test/java/org/apache/commons/numbers/core/NormTest.java         | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commons-numbers-core/src/test/java/org/apache/commons/numbers/core/NormTest.java b/commons-numbers-core/src/test/java/org/apache/commons/numbers/core/NormTest.java
index 17beea4..8d4076c 100644
--- a/commons-numbers-core/src/test/java/org/apache/commons/numbers/core/NormTest.java
+++ b/commons-numbers-core/src/test/java/org/apache/commons/numbers/core/NormTest.java
@@ -231,7 +231,7 @@ class NormTest {
 
         // compute the std devs
         final UlpErrorStats hypotStats = computeUlpErrorStats(inputs, exactResults, v -> Math.hypot(v[0], v[1]));
-        final UlpErrorStats normStats = computeUlpErrorStats(inputs, exactResults, v -> Norm.L2.of(v));
+        final UlpErrorStats normStats = computeUlpErrorStats(inputs, exactResults, v -> Norm.L2.of(v[0], v[1]));
 
         // ensure that we are within the ballpark of Math.hypot
         Assertions.assertTrue(normStats.getMean() <= (hypotStats.getMean() + HYPOT_COMPARE_EPS),