title: Postgres floating point math - do I need to do anything special?
body: <p>I am new to PG and I'm wondering if I need to 'do anything' extra to properly handle floating-point math.</p>
  
  <p>For example, in ruby you use <code>BigDecimal</code>, and in Elixir you use <code>Decimal</code>. </p>
  
  <p>Is what I have below the best solution for PG?</p>
  
  <pre><code>SELECT
    COALESCE(SUM(active_service_fees.service_fee * (1::decimal - active_service_fees.withdraw_percentage_discount)), 0)
  FROM active_service_fees
  </code></pre>
  
  <p>Data types:</p>
  
  <pre><code>service_fee integer NOT NULL
  withdraw_percentage_discount numeric(3,2) DEFAULT 0.0 NOT NULL
  </code></pre>