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

clarification on the determinism limitation from docs #271

Open
mreinstein opened this issue Feb 7, 2024 · 1 comment
Open

clarification on the determinism limitation from docs #271

mreinstein opened this issue Feb 7, 2024 · 1 comment

Comments

@mreinstein
Copy link

The docs state:

For the same input, and same binary, Box2D/Planck.js will reproduce any simulation.

People often want to know if Box2D/Planck.js can produce identical results on different binaries and on different platforms.
The answer is no. The reason for this answer has to do with how floating point math is implemented in many compilers and processors.

I remember seeing this same limitation listed in Box2D's docs, but I'm wondering if this was intentional or incidental copying? I would think that given this is a javascript implementation, there's not really a notion of a different "binary". Or is binary/platform in this case referring to the particular browser engine?

Ultimately what I'm trying to understand is if i I ship a networked application with an embedded version of chrome, and every app has this v8 version, is that considered the same binary, such that I can expect determinism?

@shakiba
Copy link
Collaborator

shakiba commented Feb 9, 2024

The library code is deterministic, however as you pointed the result depends on how floating point math is implemented where the library code runs. We need to updating the wording in the documentation and replace "binary" with "javascript runtime".

If two runtimes have the same floating point implementation I would expect the same result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants