pdiff, pmt functions