• There is a trick to achieve double the precision of your hardware, it’s explained in this video. Many languages also come with arbitrary precision numbers which are probably a lot slower.

      The main way of improving the code is however is probably understanding floats and keeping their limitations in mind.(Wikipedia article, interactive website) Floats are denser near zero and more imprecise the larger the absolute value is. This means subtracting numers that are close to each other or is a problematic operation.

      I don’t know how your code is structured but lets say your origin point is at the star. If the shuttle is approaching a space station they are relatively close together (say 1km) in compared to their distance to the origin point (150 million kilometres). If you get their relative positions by subtracting their absolute position vectors, you probably have a high rounding error (with 32 bit floats they would literally have the same position). In that case it would probably be better to use a fixed width format or chunks with local origin points, as those approaches spread representable positions more evenly in space instead of having most of them inside the star.

      I hope I gave you some useful tips on how to deal with floating point numbers, Anton.