Ephemeris needs to represent the entire solar system, at these extreme scales the precision of floating point numbers can become a serious issues. For example if the aphelion of Jupiter (5.4570 AU) is stored as metres (816,356,000,000) then the smallest possible step a single precision float (i.e. C#
f32) can represent is 65.5 kilometres!
This is a problem even on much smaller scales smaller scales. For example Unity, which uses single precision floats, recommends a max map size of 50km. At this scale the smallest possible step size is 1.95mm.
It is tempting to think that scaling the units in use, for example representing all positions as kilometres instead of metres, will gain back more precision. This is wrong.
Scaling the value down by some factor (e.g. 1000) does improves the smallest possible step size, but that step is now measured in larger units and thus has to be scaled up by the same factor. These two operations effectively cancel each other out. You can see this effect in the calculator below; the "scale" setting reduces the scale of the value but increases the scale of the step size.
This calculation is done by reinterpreting (i.e. converting it without changing the bit pattern at all) the floating point value as an integer (see here), incrementing the integer and reinterpreting it back to a float. This gets the next value along the "number line" which is the smallest possible change in value that can be represented.
Relevance To Ephemeris
Example step size at various planets:
- Jupiter (
- Saturn (
- Uranus (
- Neptune (
Ephemeris is a realistic game based on plausible, near-future technology. It is extremely unlikely this level of tech will be able to reach the farthest reaches of the solar system in any kind of vehicle that can engage in combat! The game will not set any missions beyond Uranus, to avoid exceeding the 1mm minimum step size. This yields a smaller step size than the 1.95mm step size which Unity themselves recommend.