#include "common.h"
#include "vector.h"

#if PROTOTYPE_ALLOWED
double interpolate(float *z, float *f, double zi)
#else
double interpolate(z, f, zi)
float     *z, *f;
double    zi;
#endif
{
     float     del_f, del_z, dz, fi;
     del_f = f[1] - f[0];
     del_z = z[1] - z[0];
     dz    = zi - z[0];
     fi    = f[0] + dz * del_f / del_z;
     return( fi );
}

#if 0                /******* test for interpolate **********/
#if PROTOTYPE_ALLOWED
void main(void)
#else
void main()
#endif
{
float zz[2] = { 1, 2 };
float ff[2] = { 2.5, 4.5 };
float zzi = 1.1;
printf(" interpolate to 1.1 --> %f; should be 2.7  \n",
                                  interpolate(zz,ff,zzi));
}
#endif
