Interpolation is used to calculate a value that lies a fractional distance between two given values. Given values A and B, the value N is at the fractional distance f (0 < f < 1.0) between them:
N = A + f(B-A)
For example, suppose that we want to find the value that is one-fourth (0.25) of the way between 25 and 28:
A = 25
B = 28
f = 0.25
N = A + f(B-A)
= 25 + 0.25(28-25)
= 25 + 0.25(3)
= 25 + 0.75
= 25.75