Skip to content
Snippets Groups Projects
Commit e7d5ce0b authored by Ben Gamari's avatar Ben Gamari :turtle:
Browse files

MulMayOverflow: Classify false-overflows

This will hopefully provide some indication whether MO_MulMayOflo is
excessively conservative.
parent 8c23db8b
No related branches found
No related tags found
No related merge requests found
Pipeline #86665 passed
Pipeline: test-primops

#86666

    ......@@ -34,7 +34,10 @@ prop :: forall w. (KnownWidth w)
    prop em Proxy x y = ioProperty $ do
    r <- evalMulMayOflo em x y
    let does_oflo = r /= 0
    return $ counterexample (show prod) (does_overflow ==> does_oflo)
    return
    $ classify (does_oflo && not does_overflow) "false-overflow"
    $ counterexample (show (does_overflow, prod))
    $ (does_overflow ==> does_oflo)
    where
    (min_bound, max_bound) = signedBounds (knownWidth @w)
    prod = toSigned (interpret x) * toSigned (interpret y)
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment