correct dif math function