title: Why are 2 numeric values with many decimal places considered equal in postgres?
body: <p>Why is <code>select (1.9999999999999999+2)/2 = (1.9999999999999999999999999999999999+2)/2</code> equal to <code>true</code> in postgres? Doing <code>select pg_typeof((1.9999999999999999999999999999999999+2)/2)</code> shows type <code>numeric</code>, which the docs say are exact numbers are should support thousands of digits after the decimal.</p>
  
  <p><code>select 1.9999999999999999 = 1.9999999999999999999999999999999999</code> returns <code>false</code> as expected.</p>
  
  <p>Why does select <code>(1.999999999999999+2)/2</code> show <code>1.9999999999999995</code> like I'd expect but adding an extra "9" to the end shows <code>2.0000000000000000</code>? Shouldn't the extra digit increase the precision and I should see the extra "9" in the result too?</p>
  
  <p>In what cases can I be sure I won't see this in my queries when doing arithmetic on <code>numeric</code> types?</p>