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

Method divide

java/lib/src/main/java/io/github/ccxt/Helpers.java:417–429  ·  view source on GitHub ↗
(Object a, Object b)

Source from the content-addressed store, hash-verified

415 // public float subtract(float a, float b) { return a - b; }
416
417 public static Object divide(Object a, Object b) {
418 a = normalizeIntIfNeeded(a);
419 b = normalizeIntIfNeeded(b);
420 if (a == null || b == null) return null;
421
422 if (a instanceof Long && b instanceof Long) {
423 return ((Long) a).doubleValue() / ((Long) b); // we want the reminder hence the cast
424 } else if (a instanceof Double && b instanceof Double) {
425 return ((Double) a) / ((Double) b);
426 } else {
427 return toDouble(a) / toDouble(b);
428 }
429 }
430
431 public static Object multiply(Object a, Object b) {
432 a = normalizeIntIfNeeded(a);

Callers 15

initRestRateLimiterMethod · 0.95
buildOHLCVCMethod · 0.95
cancelAllOrdersAfterMethod · 0.95
fetchOrderBookMethod · 0.95
fetchOHLCVMethod · 0.95
parseMarketMethod · 0.95

Calls 2

normalizeIntIfNeededMethod · 0.95
toDoubleMethod · 0.95

Tested by 6

divideMethod · 0.76
testFetchCurrenciesMethod · 0.76