Application Calculations
It is important to understand how the application calculates the values that are displayed in the application. This page will provide an overview of the calculations that are performed in the application.
Tax Calculations
The application calculates the tax amount based on the following formula:
Tax calculates are calculated at a line level.
Cost of product = Product Price * Cart Quantity
Tax = (Cost of product * Tax Rate) / 100
Tax Rounding
Standard Rounded: The application rounds to the nearest whole penny. If the tax amount is less than half a penny, the application will round down. If the tax amount is half a penny or more, the application will round up.
Exampe:
Tax = 0.125
Rounded Tax = 0.13
Tax = 0.134
Rounded Tax = 0.13
How Discounts are Applied
Fixed discounts
Fixed discounts are a fixed amount off from the items in the cart. Fixed discounts are divided evenley among the items in the cart based on their percent of the subtotal of line items.
For exampe you have a cart with 3 items:
Thing 1: $10
Thing 2: $20
Thing 3: $30
Cart Subtotal = $60 (before taxes and fees)
You have a fixed discount of $10
The discount will be applied as follows:
Things 1: $10 * (10/60) = $1.67
Things 2: $20 * (10/60) = $3.33
Things 3: $30 * (10/60) = $5
The amount billed per item will now be
Things 1: $10 - $1.67 = $8.33
Things 2: $20 - $3.33 = $16.67
Things 3: $30 - $5 = $25
Bankers Rounding
The application used bankers rounding when applying discounts. Bankers rounding is a method of rounding that rounds halfs to the nearest even number. This method is used to reduce bias when rounding numbers.
Example:
1.005 -> 1
1.015 -> 1.02
1.025 -> 1.02
1.035 -> 1.04
1.045 -> 1.04
1.055 -> 1.06
1.065 -> 1.06
1.075 -> 1.08
1.085 -> 1.08
1.095 -> 1.1

