| View previous topic :: View next topic |
| Author |
Message |
Trendi
Joined: 25 Jun 2006 Posts: 16
|
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 ... |
| |
|
|
|
|
andergam
Joined: 23 Jun 2006 Posts: 4
|
| Maybe you use float |
| |
|
|
Trendi
Joined: 25 Jun 2006 Posts: 16
|
| andergam, I'm converting a double to int, like so: int percentage = Math.round((100 * probability)); |
| |
|
|
andergam
Joined: 23 Jun 2006 Posts: 4
|
| Put (int) before round |
| |
|
|
Trendi
Joined: 25 Jun 2006 Posts: 16
|
| So (int) Math.round(expression); ? |
| |
|
|
andergam
Joined: 23 Jun 2006 Posts: 4
|
| Yes |
| |
|
|
Trendi
Joined: 25 Jun 2006 Posts: 16
|
| K. thank you. |
| |
|
|
andergam
Joined: 23 Jun 2006 Posts: 4
|
| Np |
| |
|
|
|
|