MCPcopy Index your code
hub / github.com/ccxt/ccxt / mod

Method mod

java/lib/src/main/java/io/github/ccxt/base/Precise.java:93–100  ·  view source on GitHub ↗
(Precise other)

Source from the content-addressed store, hash-verified

91 }
92
93 public Precise mod(Precise other) {
94 int rationizerNumerator = Math.max(-toInt(this.decimals) + toInt(other.decimals), 0);
95 BigInteger numerator = this.integer.multiply(BigInteger.valueOf(this.baseNumber).pow(rationizerNumerator));
96 int rationizerDenominator = Math.max(-toInt(other.decimals) + toInt(this.decimals), 0);
97 BigInteger denominator = other.integer.multiply(BigInteger.valueOf(this.baseNumber).pow(rationizerDenominator));
98 BigInteger result = numerator.remainder(denominator);
99 return new Precise(result.toString(), rationizerDenominator + toInt(other.decimals));
100 }
101
102 public Precise sub(Precise other) {
103 Precise negative = new Precise(other.integer.negate().toString(), other.decimals);

Callers 1

stringModMethod · 0.45

Calls 5

toIntMethod · 0.95
maxMethod · 0.45
multiplyMethod · 0.45
powMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected