code: function calc(ev) {
    var id = ev.target.id;
    if (id.slice(-1) === 'R') {
      return;
    }
    var method = id.slice(0, id.length-1);
    var args = [];
    for (var i = 1, input; input = document.getElementById(method + i); i++) {
      args.push(parseArgVal(input.value.trim()));
    }
  
    var result;
    try {
      result = args.length ? koyomi[method].apply(koyomi, args) : koyomi[method]();
    } catch(e) {
      result = 'ERR';
    }
  
    try {
      document.getElementById(method + 'R').value = resultToString(result, method);
    } catch(e) {
      console.log(e.message);
    }
  }
docs: 再計算