function log10(x) { return Math.LOG10E*Math.log(x); }

function CalcPeso() {
  var m_in=Math.abs(document.peso.medida1.options[document.peso.medida1.selectedIndex].value);
  var m_out=Math.abs(document.peso.medida2.options[document.peso.medida2.selectedIndex].value);
  var ratio=(m_in/m_out);
  var correcto=Math.abs(document.peso.cantidad.value)*ratio;
  if (correcto < 1) {
    var power=(Math.round(log10(correcto))*-1)+2;
    var mult=Math.pow(10,power);
    var result=Math.round(correcto*mult)/mult;
  } else {
    var result=Math.round(correcto*10)/10;
  }
  document.peso.respu.value=result;
}
