Returns true if x represents a mathematical integer. This is equivalent to, but not necessarily implemented as, the expression !Double.isNaN(x) && !Double.isInfinite(x) && x == Math.rint(x).
(double x)
| 277 | */ |
| 278 | |
| 279 | @GwtIncompatible // java.lang.Math.getExponent, com.google.common.math.DoubleUtils |
| 280 | public static boolean isMathematicalInteger(double x) { |
| 281 | return isFinite(x) |
| 282 | && (x == 0.0 |
| 283 | || SIGNIFICAND_BITS - Long.numberOfTrailingZeros(getSignificand(x)) <= getExponent(x)); |
| 284 | } |
| 285 | |
| 286 | /** |
| 287 | * Returns {@code n!}, that is, the product of the first {@code n} positive integers, {@code 1} if |
no test coverage detected