The formula and rounding rules
Tip = tip basis x tip percentage, rounded half up to the nearest cent. The tip basis is the bill before tax, or the bill plus tax if you choose to tip on the total. Final total = bill + tax + tip.
Round tip up raises the tip to the next whole dollar. Round total up raises the tip just enough to make the final total a whole dollar. Neither option changes an amount that is already a whole dollar, and neither ever lowers the tip.
Per person = final total / party size. Leftover cents go to some guests one cent at a time, so the shares always add up to the exact total.