How is interest calculated on a variable-rate mortgage?

 In

When calculating interest on for a variable-rate mortgage, you need the outstanding principal balance, current mortgage rate and payment frequency.
Multiply the outstanding principal amount by the mortgage rate in effect at the time. Divide that result by 365. Multiply by the number of days in the payment period in which that mortgage rate was in effect.

For a fixed-rate mortgage, interest is compounded semi-annually, not in advance.