dimforge / dimforge/nphysics

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

Open
#252 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.6k
Forks
120
PR merge metrics
No merged PRs in 30d

Description

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.

```rust
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.