xe-utils
Version:
JavaScript 函数库、工具类
9 lines (7 loc) • 515 B
JavaScript
import helperNumberDecimal from './helperNumberDecimal.js';import toNumberString from './toNumberString.js';import multiply from './multiply.js';import helperMathPow from './helperMathPow.js';function helperNumberAdd (addend, augend) {
var str1 = toNumberString(addend)
var str2 = toNumberString(augend)
var ratio = helperMathPow(10, Math.max(helperNumberDecimal(str1), helperNumberDecimal(str2)))
return (multiply(addend, ratio) + multiply(augend, ratio)) / ratio
}
export default helperNumberAdd