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

Method divide

output/java_guava/1.4.19/BigIntegerMath.java:318–323  ·  view source on GitHub ↗

Returns the result of dividing p by q, rounding using the specified RoundingMode. @throws ArithmeticException if q == 0, or if mode == UNNECESSARY and a is not an integer multiple of b

(BigInteger p, BigInteger q, RoundingMode mode)

Source from the content-addressed store, hash-verified

316 */
317
318 @GwtIncompatible // TODO
319 public static BigInteger divide(BigInteger p, BigInteger q, RoundingMode mode) {
320 BigDecimal pDec = new BigDecimal(p);
321 BigDecimal qDec = new BigDecimal(q);
322 return pDec.divide(qDec, 0, mode).toBigIntegerExact();
323 }
324
325 /**
326 * Returns {@code n!}, that is, the product of the first {@code n} positive integers, or {@code 1}

Callers 3

log10Method · 0.45
sqrtFloorMethod · 0.45
binomialMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected