The default floating point type in Java is the double. If you hard code a constant like 2.5
into your program, Java makes it a double automatically. When you do an operation on floats or ints that could potentially benefit from more precision, the type is 'promoted' to a double.
But in the Android API, everything seems to be a float from sound volumes to rectangle coordinates. There's a structure called RectF
used in most drawing; the F is for float. It's really a pain for programmers who are casting promoted doubles back to (float)
pretty often. Don't we all agree that Java code is messy and verbose enough as it is?
Usually math coprocessors and accelerators prefer double in Java because it corresponds to one of the internal types. Is there something about Android's Dalvik VM that prefers floats for some reason? Or are all the floats just a result of perversion in API design?