web hosting and development forums
Web Design and Development Forums Archive


Index - JAVA programming forum

math round function


Post reply

Heh. how do I use Math.round() ? Java keeps giving me the error: DoubleTester.java:8: possible loss of precision Yeah ... if I had the api page, I could figure it out ...
Maybe you use float
andergam, I'm converting a double to int, like so: int percentage = Math.round((100 * probability));
Put (int) before round
So (int) Math.round(expression); ?
Yes
K. thank you.
Np




Dubai Forum | Paris Forum | Webmaster Forum | Vegan Forum | Brisbane Forum | 3D Forum | Jobs in Dubai | Jobs in London | London UK Classifieds
Archive script by RedHo.com