There are a lot of good interpolation libraries available. No need to roll your own.
- bspline-fortran (1D-6D B-spline interpolation)
- finterp (1D-6D linear or nearest neighbor interpolation)
- regridpack (1D-4D linear and cubic interpolation)
- splpak (ND least-squares cubic spline fitting)
- PCHIP (1D piecewise cubic Hermite interpolation)
- fitpack (package for curve and surface fitting)