Approximating the cosine function using polynomial interpolation