title: Magento why 3 tax calculation methods?
body: <p>Today I was studying how Magento tax calculation works to understand the difference between the behaviors for "<strong>Tax Calculation Method Based On</strong>".</p>
  
  <p>I traced deep into <strong>Mage_Tax_Model_Sales_Total_Quote_Tax</strong> which implements all methods in the <strong>_unitBaseCalculation</strong>, <strong>_rowBaseCalculation</strong>, <strong>_totalBaseCalculation</strong>.</p>
  
  <p>I discovered that they produce exactly the same results. So why did they go through the trouble of implementing them ?</p>
  
  <p>For example, unit-price calculation goes to the trouble of calculating the tax for the single unit and then dividing the discount amount by the qty (if tax applied after discount), then subtracting both, and then multiplying again by the quantity... which just introduces rounding errors.</p>
  
  <p>Whereas Row Total calculation is the most intuitive one (which takes the price from the row "subtotal") minus discount amount (if tax applied after discount).</p>
  
  <p>While the third one is just an aggregation of the second, calculated at once.</p>
  
  <p>This just introduces confusion and obfuscation to the tax calculation logic. Can anyone shed a light onto why this was done ?</p>
  
  <p>(Rounding errors ? Backward compatibility ? Candidate for TheDailyWTF prize ?)</p>
  
  <p><strong>EDIT</strong>: For the record this is true as of Magento 1.6 and 1.7, don't know about older versions.</p>