Re: Truncating Doubles
Posted: Thu Feb 23, 2023 1:53 pm
The core java math class also provides implementations that properly rounds, truncates, performs ceiling, and similar. For instance, one of the round methods are:
static long round(double a) -- Returns the closest long to the argument, with ties rounding to positive infinity.
https://docs.oracle.com/en/java/javase/ ... /Math.html
static long round(double a) -- Returns the closest long to the argument, with ties rounding to positive infinity.
https://docs.oracle.com/en/java/javase/ ... /Math.html