title: Rounding When Last Number is Zero - Applescript
body: <p>I've been using a simple little script for rounding numbers to the hundredths decimal place, however I've noticed that when the number ends in zero, it rounds up to the next decimal place. I need to preserve this decimal place. </p>
  
  <p><strong>For example:</strong> 7.49908302 would be rounded to 7.5 instead of 7.50.</p>
  
  <p>How can I keep the hundredths decimal with this subroutine? Should I try something Perl or Objective C, as I've been told Applescript isn't the best for this sort of thing.</p>
  
  <p><strong>Here's the call:</strong></p>
  
  <pre><code>set finalAge514years to (roundThis(age514years, 2))
  </code></pre>
  
  <p><strong>Here's my rounding subroutine:</strong></p>
  
  <pre><code>on roundThis(n, numDecimals)
      set x to 10 ^ numDecimals
      (((n * x) + 0.5) div 1) / x
  end roundThis
  </code></pre>