|
@@ -7,13 +7,10 @@ export function add(a, b) {
|
|
|
return (a * powN + b * powN) / powN;
|
|
return (a * powN + b * powN) / powN;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-export function multiply(a, b) {
|
|
|
|
|
-
|
|
|
|
|
- let aLen = (a + '').split('.')[1]?.length || 0;
|
|
|
|
|
- let bLen = (b + '').split('.')[1]?.length || 0;
|
|
|
|
|
-
|
|
|
|
|
- const powA = Math.pow(10, aLen);
|
|
|
|
|
- const powB = Math.pow(10, bLen);
|
|
|
|
|
|
|
+export function multiply(arg1, arg2) {
|
|
|
|
|
+ var m = 0, s1 = arg1.toString(), s2 = arg2.toString();
|
|
|
|
|
+ try { m += s1.split(".")[1].length } catch (e) { }
|
|
|
|
|
+ try { m += s2.split(".")[1].length } catch (e) { }
|
|
|
|
|
+ return Number(s1.replace(".", "")) * Number(s2.replace(".", "")) / Math.pow(10, m)
|
|
|
|
|
|
|
|
- return (a * powA * (b * powB)) / (powA * powB);
|
|
|
|
|
}
|
|
}
|