MCPcopy Create free account
hub / github.com/antlr/codebuff / roundToLong

Method roundToLong

output/java_guava/1.4.19/DoubleMath.java:149–154  ·  view source on GitHub ↗

Returns the long 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, i

(double x, RoundingMode mode)

Source from the content-addressed store, hash-verified

147 */
148
149 @GwtIncompatible // #roundIntermediate
150 public static long roundToLong(double x, RoundingMode mode) {
151 double z = roundIntermediate(x, mode);
152 checkInRange(MIN_LONG_AS_DOUBLE - z < 1.0 & z < MAX_LONG_AS_DOUBLE_PLUS_ONE);
153 return (long) z;
154 }
155
156 private static final double MIN_LONG_AS_DOUBLE = -0x1p63;
157 /*

Callers

nothing calls this directly

Calls 2

roundIntermediateMethod · 0.95
checkInRangeMethod · 0.45

Tested by

no test coverage detected