I am programming a physic simulation, and every element of the system simulated is described whit three dimension (x, y, z) stored in three long double
. Well, my precision would be pretty precise, and I'd like to simulate enough vast systems, like the solar system. Considering the Sun in the center, how much can I go further to keep precision higher or equal to millimeter, and which measurement unit should I use?
P.S.:
I know that the solar system is much larger that the distance Sun-Pluto, but that distance is the minimum size that I'd like to consider valid in my simulation
The "Pluto/Sun mean distance" is 5.9*1012 meters or 5.9*1015 mm.
Typical
double
has 253 or about 9*1015 decimal precision and so can represent the Sun/Pluto distance exactly - to the millimeter.Start with
double
and focus on code's various calculations that may compromise precision. If necessary uselong double
, yet I suspectdouble
will work for you.