- #1
sunilkamadolli
- 41
- 0
hey everybody, i was writing a java program and i could not figure out how to round a number[double] to 4 decimal places...i tried a lot of things
the math function's round function rounds the double to one decimal place so that does not work.
i tried various algorithms like dividing by .0001 and then rounded it and stored it into an integer and then divided the integer by 1000...still not working
please help me out...even non-java programmers can help by telling me the algorithm...thank u.
the math function's round function rounds the double to one decimal place so that does not work.
i tried various algorithms like dividing by .0001 and then rounded it and stored it into an integer and then divided the integer by 1000...still not working
please help me out...even non-java programmers can help by telling me the algorithm...thank u.