Since they are small numbers dont take a double for these |
It's not going to matter, unless there are billions of them.
As I said the precision of a
float
is easily exceeded, so best to make them
double
and not worry about that.
An example of exceeding precision:
Say we need 3 dp for our numbers, a float might have 6 significant figures, so that only leaves 3 more figures, which gives a max for out number of
999.999
. If our numbers in a container are about
50.0
, we can only have 20 numbers before we loose precision on the sum of those numbers. Not to mention squaring and square roots, reciprocals etc.
If we were to choose
double
(15sf) in the same scenario, our sum could be
9.99999999999999e12
, which is clearly much better.
Using c style casts aren't recommended either.