Best Unit of Measurement for Conversion

I'm creating a class with that does a lot of conversion(miles to kilometers, feet to yards, meters to miles).

What is the type of number to use?:

1. int

2. double

3. f oat

4. long

and obvioulsy not an int.

[249 byte] By [blackmagea] at [2007-11-27 11:16:03]
# 1

There's almost never any point in using float unless you were in a very limited memory environment.

Int and long don't make sense, since these are non-integer quantities.

You *could* use BigDecimal, but this isn't money, so the fixed decimal precision is probably unnecessary.

I'd go with double.

jverda at 2007-7-29 14:16:51 > top of Java-index,Java Essentials,Java Programming...