Skip to content

check the errors in testRoundTripFuzz #36

Description

@thedavidmeister
    function testRoundTripFuzz(Float a, Float b) external {
        try this.powerExternal(a, b) returns (Float c) {
            // If b is zero we'll divide by zero on the inv.
            // If c is 1 then it's not round trippable because 1^x = 1 for all x.
            // C will be 1 when a is 1 or b is 0 (or very close to either).
            if (b.isZero() || c.eq(LibDecimalFloat.packLossless(1, 0))) {} else {
                Float inv = b.inv();
                try this.powerExternal(c, inv) returns (Float roundTrip) {
                    if (roundTrip.isZero()) {} else {
                        Float diff = a.divide(roundTrip).sub(LibDecimalFloat.packLossless(1, 0)).abs();
                        assertTrue(!diff.gt(diffLimit()), "diff");
                    }
                } catch (bytes memory err) {}
            }
        } catch (bytes memory err) {}
    }

these catches need to be handled

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions