

Where k runs from 1 to n and xp is the interpolation variable to which the value yp shall be calculated later on.
The interpolation value yp becomes now the sum of all the Lk* yk terms whereas yk is the y value of one supporting point.

The interpolation for one interpolation point is made in one loop including the calculation of all the Lk elements and adding the multiplication of Lk * yk together:
for (i = 0; i < order; i++)
{
enumerator = 1.0;
denominator = 1.0;
/* calculate the Lk elements */
for (k = 0; k < order; k++)
{
if
(k != i)
{
}{
/* enumerator and
denominator for one L element */
enumerator = enumerator * (xp - x_k[k]);
denominator = denominator * (x_k[i] - x_k[k]);
}enumerator = enumerator * (xp - x_k[k]);
denominator = denominator * (x_k[i] - x_k[k]);
/* put every thing thogether to yp*/
if (denominator != 0.0)
yp = yp + y_k[i] * enumerator / denominator;
else
yp = 0.0;
}
This loop calculates one yp interpolation value.
For other approaches see Polynomial interpolation, Newton interpolation, Newton Gregory interpolation, Interpolation by Chebychev polynomials