title: Typescript subtraction with decimal numbers
body: <p>I have a table that tracks stock level changes, on most occasions the addition/subtraction is with whole numbers (-1, -2, +2, +3) etc. However, on some instances +0.5, -0.25 may be required. My current code get the correct values, but when it comes to decimals, it will on deduct or add to the nearest whole number (+1/-1). The oldValue and newValue variable are populated from a stock changes table and I'm displaying the number of change from stock.</p>
  <p>Below is the calculation function -</p>
  <pre><code>  formatDifference(change: StockChange) {
      const difference = parseInt(change.newValue || '0', 10) - parseInt(change.oldValue || '0', 10);
      return difference &gt; 0 ? '+' + difference : difference;
    }
  </code></pre>
  <p>HTML -</p>
  <pre><code>&lt;td style=&quot;text-align: center;&quot;&gt;
    ({{formatDifference(change)}})
    &lt;div class=&quot;stockLabel&quot;&gt;
     Difference
    &lt;/div&gt;
  &lt;/td&gt;
  </code></pre>