Skip to content

Conversation

leftaroundabout
Copy link
Contributor

It is actually surprising how many tests hold exactly, with standard equality. But not all of them do. Prior to this fix:

Failures:

  test/ArrayFire/LAPACKSpec.hs:36:9: 
  1) ArrayFire.LAPACK, LAPACK spec, Should get determinant of Double
       expected: -14.0
        but got: -13.999999999999996

  To rerun use: --match "/ArrayFire.LAPACK/LAPACK spec/Should get determinant of Double/" --seed 882460504

  test/ArrayFire/StatisticsSpec.hs:18:9: 
  2) ArrayFire.Statistics, Statistics spec, Should find the weighted-mean
       expected: ArrayFire Array
                 [1 1 1 1]
                     7.0000 
                 
        but got: ArrayFire Array
                 [1 1 1 1]
                     7.0000 

This is due to ordinary and inevitable inexactness of floating point calculations (in the latter case, the error is so small it doesn't even appear in the printed result), and it should not be counted as a failure of the test suite.

This PR makes these two tests lenient WRT such small float deviations.

…ror.

It is actually surprising how many tests hold exactly, with standard equality.
But not all of them do.
@leftaroundabout
Copy link
Contributor Author

This fixes #49

@dmjio dmjio merged commit f268fc9 into arrayfire:master May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants