function addNum (num1, num2) {
  let sq1, sq2
  try {
    sq1 = _toString(num1).split('.')[1].length
  } catch (e) {
    sq1 = 0
  }
  try {
    sq2 = _toString(num2).split('.')[1].length
  } catch (e) {
    sq2 = 0
  }
  const m = Math.pow(10, Math.max(sq1, sq2))
  return (Math.round(num1 * m) + Math.round(num2 * m)) / m
}
function addNum (num1, num2) {
  let sq1, sq2
  try {
    sq1 = _toString(num1).split('.')[1].length
  } catch (e) {
    sq1 = 0
  }
  try {
    sq2 = _toString(num2).split('.')[1].length
  } catch (e) {
    sq2 = 0
  }
  const m = Math.pow(10, Math.max(sq1, sq2))
  return (Math.round(num1 * m) + Math.round(num2 * m)) / m
}
function addNum ( num1 , num2 ) { let sq1 , sq2 try { sq1 = _toString ( num1 ) . split ( '.' ) [ 1 ] . length } catch ( e ) { sq1 = 0 } try { sq2 = _toString ( num2 ) . split ( '.' ) [ 1 ] . length } catch ( e ) { sq2 = 0 } const m = Math . pow ( 10 , Math . max ( sq1 , sq2 ) ) return ( Math . round ( num1 * m ) + Math . round ( num2 * m ) ) / m }
实现两数相加并保留小数点后最短尾数
实现两数相加并保留小数点后最短尾数
Add two numbers