Returns the result of rounding the argument to an integer. The result is equivalent to (long) Math.floor(d+0.5). Special cases: round(+0.0) = +0.0 round(-0.0) = +0.0 round((anything > Long.MAX_VALUE) = Long.MAX_VALUE {@code roun
(double d)
| 172 | * @return the closest integer to the argument. |
| 173 | */ |
| 174 | public static long round(double d) { |
| 175 | // check for NaN |
| 176 | if (d != d) { |
| 177 | return 0L; |
| 178 | } |
| 179 | return (long) floor(d + 0.5d); |
| 180 | } |
| 181 | |
| 182 | /** |
| 183 | * Returns the result of rounding the argument to an integer. The result is |