Skip to content

Tests fail when built against QuickCheck-2.14.3 #460

Description

@Bodigrim
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.

Activity

  1. Shimuuar commented on Jun 3, 2023

    @Shimuuar
    Contributor

    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

  2. Bodigrim commented on Jun 4, 2023

    @Bodigrim
    ContributorAuthor

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions