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

Test failing on Apple M1 due to float discrepancy > epsilon #137

Closed
RJ opened this issue Aug 30, 2023 · 1 comment · Fixed by #138
Closed

Test failing on Apple M1 due to float discrepancy > epsilon #137

RJ opened this issue Aug 30, 2023 · 1 comment · Fixed by #138
Labels
C-Testing Improvements or additions to testing question Further information is requested

Comments

@RJ
Copy link
Contributor

RJ commented Aug 30, 2023

I have a branch to fix a couple of places where assert_eq is changed to assert_relative_eq to make the tests pass on a mac M1.

This one I want to flag/query though - since it has a specific epsilon, and the difference in expected and observed values is much larger than the epsilon.

If this difference between left and right is within the acceptable range?
I could change the epsilon to make it pass? or change the epsilon just for apple-m1?
Seems weird it's such a large difference.

Anyway, happy to try and get all tests passing on m1 with a bit of guidance. thanks

The failing test:

        assert_relative_eq!(
            mass_props.mass.0,
            original_mass_props.mass.0,
            epsilon = 0.000_001
        );

output from cargo test:

failures:

---- components::world_queries::tests::mass_properties_add_sub_works stdout ----
thread 'components::world_queries::tests::mass_properties_add_sub_works' panicked at 'assert_relative_eq!(mass_props.mass.0, original_mass_props.mass.0, epsilon = 0.000_001)

    left  = 15.642822
    right = 15.6427965

', crates/bevy_xpbd_2d/../../src/components/world_queries.rs:257:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    components::world_queries::tests::mass_properties_add_sub_works
@Jondolf
Copy link
Owner

Jondolf commented Aug 30, 2023

You can just make the epsilon larger to make it pass. It's weird that the difference is that large though, because that particular test just does mass_a + mass_b - mass_b == mass_a. It also works on Windows and Ubuntu (my PC and CI).

@Jondolf Jondolf added question Further information is requested C-Testing Improvements or additions to testing labels Aug 30, 2023
RJ added a commit to RJ/avian that referenced this issue Aug 30, 2023
@Jondolf Jondolf linked a pull request Aug 30, 2023 that will close this issue
Jondolf pushed a commit that referenced this issue Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Testing Improvements or additions to testing question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants