Returns the int value that is equal to x rounded with the specified rounding mode, if possible. @throws ArithmeticException if x is infinite or NaN x, after being rounded to a mathematical integer using the specified rounding mode, is
(double x, RoundingMode mode)
| 122 | */ |
| 123 | |
| 124 | @GwtIncompatible // #roundIntermediate |
| 125 | public static int roundToInt(double x, RoundingMode mode) { |
| 126 | double z = roundIntermediate(x, mode); |
| 127 | checkInRange(z > MIN_INT_AS_DOUBLE - 1.0 & z < MAX_INT_AS_DOUBLE + 1.0); |
| 128 | return (int) z; |
| 129 | } |
| 130 | |
| 131 | private static final double MIN_INT_AS_DOUBLE = -0x1p31; |
| 132 | private static final double MAX_INT_AS_DOUBLE = 0x1p31 - 1.0; |
nothing calls this directly
no test coverage detected