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

Perform internal computations in long double #319

Merged
merged 2 commits into from
Nov 20, 2017

Conversation

lidavidm
Copy link
Contributor

This is an attempted fix for #135. However, it makes the values in the replay quite misleading; under the case that @shummie submitted, while the engine now correctly computes that ships 9 and 11 are far enough apart to not collide, the values in the JSON suggest they should have collided, even with the tweak suggested in nlohmann/json#360.

@lidavidm lidavidm requested a review from j-clap November 20, 2017 01:59
@j-clap
Copy link
Contributor

j-clap commented Nov 20, 2017

I must say I highly disagree with this change, considering this will now become a rabbit hole of how far we do consider the mantissa (what's next? Quadruple precision ieee-754? ). I would rather us set a predictable value as a standard and not budge from there. Also note that this can be unpredictable across arches, since cpp only guarantees long double to be as large as double (technically double is only as large as first by the standard as well, but I've found it more consistant); not that it matters to us since wee only on one arch, but good to note.

@lidavidm
Copy link
Contributor Author

Another possible fix is to explicitly check collisions again after updating positions (since the issue here is that the ship moves slightly further than the magnitude of the velocity suggests), but that feels janky to me as well.

@j-clap
Copy link
Contributor

j-clap commented Nov 20, 2017

That being said, though I disagree with the idea, I will approve since we're already here and the code is already changed, and no detrimental effect should arise.

@j-clap
Copy link
Contributor

j-clap commented Nov 20, 2017

Yes, they both have issues. I'm not sure this will solve the issue entirely though. But no harm in trying :)

@lidavidm
Copy link
Contributor Author

Yeah, this will definitely not fully solve the issue either, just make it (hopefully) less likely (though I don't think it was all that likely to begin with).

@snaar
Copy link
Collaborator

snaar commented Nov 20, 2017

Maybe next time fixed point math :P

@j-clap
Copy link
Contributor

j-clap commented Nov 20, 2017

We used to have it, then people complained :(

@lidavidm
Copy link
Contributor Author

It was more like perform double computations -> round positions to integers (and IIRC velocities (when we had inertia still) were still doubles) so that was a weird mix.

@snaar snaar merged commit f3a2df3 into HaliteChallenge:master Nov 20, 2017
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

Successfully merging this pull request may close these issues.

3 participants