More Precision Issues, and PR

Hey Folks! A bit of a slower day today, as a chunk of it was spent tackling public relations type tasks, and a bit of admin. I did get some coding done, however, aiming to address precision issues in the sim.

Yesterday, I talked a bit about precision and time. As it turns out, single precision floating point variables can only store 7-significant digits of info. And when we're talking about the number of seconds in years (months, even), we quickly get large enough numbers that individual seconds are ignored by the CPU.

This is where "double" comes in. As you could probably guess, it has double the precision of single (a.k.a. float) variables. That means 15 digits. And in the scale of seconds-per-year (which has 8 digits), easily more than enough. Enough to have 10000000 years! I think that should safely cover most crews in the game :)

So I've updated the code to use double for tracking time, and that seems to do the trick. I'm getting appropriate time passage in realtime, as well as when fast-forwarding years into the future.

And for a brief moment, I thought that was it. I resumed adding some UI enhancements to make it more playable, like a "Max g" readout to show maximum acceleration of a trip. And then when I went to test something, I ran into another issue: my ship wasn't going anywhere. And upon further investigation, it looks like yet another float precision issue!

I have a hunch that all the testing I did before was within a certain radius of the Sun, which meant all the distances were small enough that 1g thrust could still register within 7 digits of precision when it modified the position. Probably just barely, since now I'm testing only slightly further out and hitting the precision wall. (E.g. subtracting 9.8 meters from 150,000,000,000 meters, or 1au, gets ignored by the CPU)

So I'm in the process of switching out the float-based position info on a ship, and replacing it with double precision X and Y position. In theory, this should also cover any ships flying out to around 100,000au from the Sun.

Past that, I guess you're on your own :)


Marc13Bautista's picture


Free Elusive Skill = Athletic x4 in ATN Enclave encounter