The correct1 answer is most likely to use float
. If you use it correctly, float
is capable of representing numbers as small as 1.1755e-38
(normalized).
My guess is that you didn't write the float
literal correctly. The literal 0.001
is actually a double
. If you want a float
literal you need to use an f
or F
suffix; i.e. 0.001f
.
(This guess is consistent with the error message ....)
1 - Changing to use double
instead of float
is also a good answer. The difference is performance and space usage is unlikely to be significant, and the extra precision of double
may be beneficial. On the other hand, the dynamics of n-body interactions are unstable. Unless you get really deeply into the mathematics (numerical analysis) of solving the DE's numerically before writing your code, you are likely find that it is not floating point precision that limits the fidelity of your modelling ...