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.
It is actually surprising how many tests hold exactly, with standard equality. But not all of them do. Prior to this fix:
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.