times static method
精确乘法
num1
左操作数 num2
右操作数
others
更多操作数使用数组传递
譬如 times(1, 2, 22,33
)
Implementation
static num times(dynamic num1, dynamic num2, [List<dynamic>? others]) {
if (others != null) {
return times(times(num1, num2), others[0], others.length >= 2 ? others.sublist(1) : null);
}
num num1Changed = float2Fixed(num1);
num num2Changed = float2Fixed(num2);
num baseNum = digitLength(num1) + digitLength(num2);
num leftValue = num1Changed * num2Changed;
checkBoundary(leftValue);
// if (leftValue.toString().length + baseNum < 20) {
return NP.strip(leftValue / pow(10, baseNum));
// } else {
// return NP.strip(num.parse('${leftValue}e-$baseNum'));
// }
}