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

Method divide

output/java_guava/1.4.16/BigIntegerMath.java:317–322  ·  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

315 */
316
317 @GwtIncompatible // TODO
318 public static BigInteger divide(BigInteger p, BigInteger q, RoundingMode mode) {
319 BigDecimal pDec = new BigDecimal(p);
320 BigDecimal qDec = new BigDecimal(q);
321 return pDec.divide(qDec, 0, mode).toBigIntegerExact();
322 }
323
324 /**
325 * 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