Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests fail when built against QuickCheck-2.14.3 #460

Closed
Bodigrim opened this issue Jun 2, 2023 · 2 comments · Fixed by #461
Closed

Tests fail when built against QuickCheck-2.14.3 #460

Bodigrim opened this issue Jun 2, 2023 · 2 comments · Fixed by #461

Comments

@Bodigrim
Copy link
Contributor

Bodigrim commented Jun 2, 2023

Test suite vector-tests-O2: RUNNING...
toplevel
  Tests.Vector.Unboxed
    (Float)
      product:                                   FAIL
        *** Failed! Falsified (after 60 tests):
        [32.0,-18.487179,-46.0,4.0,1.3333334,-0.33333334,-19.0,-32.022728,1.6666666,0.4007722,45.192307,0.375,-49.0,45.210526,27.458334,16.0,33.97059,-18.466667,57.939392,-40.0,-18.0,0.81411356,-7.0,-9.222222,-0.25,-17.0,31.85965,-0.5714286,58.6,-38.01695,0.2850433,6.1225712e-2,0.75,46.0,19.666666,-13.0,-0.3773585,18.5,20.0,0.8629303,0.7045016,18.458334,0.18349916,1.125,32.06,-41.757576,-47.0,20.8,-31.714285,-41.363636,-11.896552,0.0,-19.0]
        NaN /= NaN
        Use --quickcheck-replay=745456 to reproduce.
        Use -p '/(Float).product/' to rerun this test only.
@Shimuuar
Copy link
Contributor

Shimuuar commented Jun 3, 2023

This has nothing to do with QC version. Just usual floating point shenanigans. Single precision float is not difficult to overflow with maximum finite number of about 1e38. In this example multiplication first overflows to infinity and then is multiplied by zero (second to last) getting NaN.

I guess we should use newtype wrapper over floats for which NaN==NaN = True

@Bodigrim
Copy link
Contributor Author

Bodigrim commented Jun 4, 2023

QuickCheck-2.14.3 changed instance Arbitrary Float to generate more "interesting" numbers, thus increasing chances of this fault to almost 100%.

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 a pull request may close this issue.

2 participants