Java – Whether Android disables floating-point types

Whether Android disables floating-point types… here is a solution to the problem.

Whether Android disables floating-point types

A page on the Android developer website mentions that you should (quote): “Avoid floats” (link: Performance Tips)

Looking at the whole article, it seems that some of the entries may be a bit outdated (probably written years ago).

I wonder if this guideline still works today, or if it’s really bad to use floating-point types (x2 performance loss, even on today’s hardware)?

Solution

Older Android devices such as ARMv6 do not support floating-point processors. If you stick with Java, you will use float through emulation, and although it can run on older devices, if you use float in a display loop or update something similar more than 20 times, your software will be very slow and drain on power per second.

ARMv7 and later have floating-point arithmetic support, so even if you think your software must support older devices, fixed-point or integer arithmetic is preferred, which is not a big deal.

See OpenGL/High-Performance Android App Related Issues:
Floating point or fixed-point for Android NDK OpenGL apps?

Related Problems and Solutions