/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:33:16 */ /*FOR_C Options SET: ftn=u io=c no=p op=aimnv pf=,p_shint s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_shint.h" /* program DRSHINT *>> 1996-05-28 DRSHINT Krogh Added external statement. *>> 1994-10-19 DRSHINT Krogh Changes to use M77CON *>> 1987-12-09 DRSHINT Lawson Initial Code. *--S replaces "?": DR?HINT, ?HINT * */ int main( ) { long int i, j; float x, yint, ypint, yptab[3], ytab[3], ytrue; static float xtab[3]={0.e0,.5e0,.75e0}; static long ntab = 3; /* OFFSET Vectors w/subscript range: 1 to dimension */ float *const Xtab = &xtab[0] - 1; float *const Yptab = &yptab[0] - 1; float *const Ytab = &ytab[0] - 1; /* end of OFFSET VECTORS */ for (i = 1; i <= 3; i++) { Ytab[i] = expf( Xtab[i] ); Yptab[i] = Ytab[i]; } printf(" Demonstration of SHINT by interpolating to the exponential function,\n given values at X = 0.0, 0.5, and 0.75\n\n X YTRUE YINT YINT-YTRUE YPINT YPINT-YTRUE\n \n"); for (j = 10; j <= 110; j += 5) { x = (float)( j )/100.e0 - 0.1e0; yint = shint( x, 0, ntab, xtab, ytab, yptab ); ypint = shint( x, 1, ntab, xtab, ytab, yptab ); ytrue = expf( x ); printf(" %5.2f%13.6f%13.6f%13.6f%13.6f%13.6f\n", x, ytrue, yint, yint - ytrue, ypint, ypint - ytrue); } exit(0); } /* end of function */