Skip to content

The mechanical world stops updating after 524,288 seconds when using f32 precision #252

Description

@MJohnson459

I have created a simulator based on nphysics and I've noticed that after 6 days the mechanical world stops ticking correctly. This seems to be a floating point precision issue regarding the parameters t and dt. Using the default dt = 1.0/60.0 then the simulator stops at exactly 524,288 seconds.

let t = 524288.0f32;
assert_eq!(t + 1.0/60.0, t);

While it would be possible to change the simulator to run on f64 values, nothing apart from the time requires that precision.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions