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

Method mathAbs

java/lib/src/main/java/io/github/ccxt/Helpers.java:1198–1232  ·  view source on GitHub ↗
(Object val)

Source from the content-addressed store, hash-verified

1196 }
1197
1198 public static Object mathAbs(Object val) {
1199 if (val == null) {
1200 return null;
1201 }
1202
1203 if (val instanceof Integer) {
1204 return Math.abs((Integer) val);
1205 }
1206
1207 if (val instanceof Long) {
1208 return Math.abs((Long) val);
1209 }
1210
1211 if (val instanceof Float) {
1212 return Math.abs((Float) val);
1213 }
1214
1215 if (val instanceof Double) {
1216 return Math.abs((Double) val);
1217 }
1218
1219 if (val instanceof BigDecimal) {
1220 return ((BigDecimal) val).abs();
1221 }
1222
1223 // if (val instanceof BigInteger) {
1224 // return ((BigInteger) val).abs();
1225 // }
1226
1227 if (val instanceof Number) {
1228 return Math.abs(((Number) val).doubleValue());
1229 }
1230
1231 return null;
1232 }
1233
1234 public static boolean isInstance(Object value, Object type) {
1235 if (!(type instanceof Class<?> clazz)) {

Callers 1

Calls 1

absMethod · 0.45

Tested by 1