/*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_sint1f s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_sint1f.h" /* DRSINT1F *>> 2000-12-03 DRSINT1F Krogh Declared WORK as WORK(1) in SINTF. *>> 1994-11-02 DRSINT1F Krogh Changes to use M77CON *>> 1994-08-08 DRSINT1F Snyder Took '0' out of formats for C conversion *>> 1993-05-05 DRSINT1F Krogh Adjusted to simplify conversion to C. *>> 1987-12-09 DRSINT1F Snyder Initial Code. *--S replaces "?": DR?INT1f, ?INT1, ?INTF * * DEMO DRIVER for 1 dimensional quadrature subprogram SINT1. * * Compute the integral for X = 0.0 to X = PI of SIN(X), then * subtract 2.0 from the ANSWER. The result should be zero. * * The integrand is evaluated by the subprogram SINTF. * * */ int main( ) { long int iopt[10]; float a, answer, b, work[1]; /* OFFSET Vectors w/subscript range: 1 to dimension */ long *const Iopt = &iopt[0] - 1; float *const Work = &work[0] - 1; /* end of OFFSET VECTORS */ printf("\n DRSINT1F:\n Compute the integral for X = 0.0 to X = PI of SIN(X), then\n subtract 2.0 from the ANSWER. The result should be zero.\n"); a = 0.0e0; b = 4.0e0*atanf( 1.0e0 ); Iopt[2] = 10; Iopt[3] = 0; Iopt[4] = 0; sint1( a, b, &answer, work, iopt ); answer -= 2.0e0; printf("\n ANSWER =%15.8g\n ERROR ESTIMATE =%15.8g\n STATUS FLAG =%6ld\n FUNCTION VALUES =%6ld\n", answer, Work[1], Iopt[1], Iopt[3]); exit(0); } /* end of function */ /* End of DRSINT1F */ void /*FUNCTION*/ sintf( float *answer, float work[], long *iflag) { /* OFFSET Vectors w/subscript range: 1 to dimension */ float *const Work = &work[0] - 1; /* end of OFFSET VECTORS */ /* Subroutine to provide integrand for SINT1. * */ /* IFLAG is not used in this example. * */ *answer = sinf( Work[1] ); return; } /* end of function */