You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Alex Herbert (Jira)" <ji...@apache.org> on 2023/07/15 17:46:00 UTC

[jira] [Commented] (GEOMETRY-161) use the same EPS values for vector tests

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

Alex Herbert commented on GEOMETRY-161:
---------------------------------------

Note that the test tolerances are different:
{code:java}
jshell> 1e-15 / Math.ulp(1d)
$1 ==> 4.503599627370496 {code}
I presume the Vector2D test is using a more accurate EPS as the tolerance would depend on the test data.

 

> use the same EPS values for vector tests
> ----------------------------------------
>
>                 Key: GEOMETRY-161
>                 URL: https://issues.apache.org/jira/browse/GEOMETRY-161
>             Project: Commons Geometry
>          Issue Type: Improvement
>          Components: euclidean1D, euclidean2D, euclidean3D
>            Reporter: Dimitrios Efthymiou
>            Priority: Minor
>              Labels: easyfix
>
> The test classes Vector1DTest, Vector2DTest, Vector3DTest have EPS variables
> at the beginning of these classes.
> Vector1DTest has double TEST_TOLERANCE = 1e-15,
> Vector2DTest has double EPS = Math.ulp(1d),
> Vector3DTest has double EPS = 1e-15
> I created this variable for my tests in all 3 classes:
> private static final Precision.DoubleEquivalence TEST_PRECISION =Precision.doubleEquivalenceOfEpsilon(EPS);
> I would like to either create a class, like, VectorUtils and put in it the 2 lines:
> static final double EPS = Math.ulp(1d);
> static final Precision.DoubleEquivalence TEST_PRECISION =Precision.doubleEquivalenceOfEpsilon(EPS);
> and use them within the other test classes or create a class, like,
> VectorTestBase or BaseVectorTest that Vector1DTest, Vector2DTest, Vector3DTest will extend and put in VectorTestBase:
> protected final double EPS = Math.ulp(1d);
> protected final Precision.DoubleEquivalence TEST_PRECISION =Precision.doubleEquivalenceOfEpsilon(EPS);



--
This message was sent by Atlassian Jira
(v8.20.10#820010)