title: how to get percentage a day to more precision from javascript momentjs.asHours()?
body: <p>I have table like this:</p>
  
  <p><a href="https://i.stack.imgur.com/bsD39.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bsD39.png" alt="enter image description here"></a></p>
  
  <p>The total of the Percentage column must be 100%, but I'm getting 100.01%.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>var hourSlow = $("#input-me-slow").val();
  var slowTime = moment.duration(hourSlow).asHours();
  // slow time return 2.1666666666666665
  
  var hourIdle = $("#input-me-idle").val();
  var idleTime = moment.duration(hourIdle).asHours()
  // idle time return 1
  
  var hourEco = $("#input-me-eco").val();
  var ecoTime = moment.duration(hourEco).asHours();
  // ecoTime return 20.166666666666668
  
  var hourSpeed = $("#input-me-speed").val();
  var speedTime = moment.duration(hourSpeed).asHours();
  // speedTime return 0.6666666666666666
  
  var fTime = "24:00"
  var dfTime = moment.duration(fTime).asHours();
  // dfTime return 24
  
  var totalTime = dfTime-speedTime-ecoTime-slowTime-idleTime;
  // totalTime return -2.220446049250313e-15
  
  
  // Here for display it to table, the problem is here
  var fPercent = toHour(fullTime); //return 2.78
  var ePercent = toHour(ecoTime); //return 84.03
  var sPercent = toHour(slowTime); //return 9.03
  var iPercent = toHour(idleTime); //return 4.17
  $("#me_fullpercen").text(addCommas(fPercent));
  $("#me_ecopercen").text(addCommas(ePercent));
  $("#me_slowpercen").text(addCommas(sPercent));
  $("#me_idlepercen").text(addCommas(iPercent));
  
  // here the function of toHour (I dont know maybe the problem is here)
  function toHour(num) {
      var result = (num / 24) * 100;
      return result ;
  }
  </code></pre>
  
  <p>I would rather not round the percentage to 100%, as that would be less precise.</p>
  
  <h2><em>How can I make my percentage 100% instead of 100.01%?</em></h2>