I am trying to make a program that requires some user input, performs a few calculations and prints the answer. My problem is that this answer sometimes lasts a lot of decimals, which causes some aesthetic and layout problems. I need to display only 4 decimal places. In any case, to limit the accuracy of these numbers to the output? (The numbers are stored in floats, and I'm programming for Android.)
android floating-point precision
Tom c
source share