You should start with the accuracy you desire. Once you have determined that, you can choose a data type that is suitable.
If you decide that an accuracy of 5 decimal places (1.1132 m) is enough, you can easily go with float
. The more accurate your calculation needs to be, the more you should lean towards using double
and eventually BigDecimal
.
When comparing floating point numbers, you should incorporate the necessary precision as well.