/*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_sint1r s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include #include #include "p_sint1r.h" /* program DRSINT1R *>> 1994-10-19 DRSINT1R Krogh Changes to use M77CON *>> 1994-08-08 DRSINT1R Snyder Took '0' out of formats for C conversion *>> 1991-11-20 CLL Edited for Fortran 90. *>> 1987-12-09 DRSINT1R Snyder Initial Code. *--S replaces "?": DR?INT1R, ?INT1, ?INTA * * 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 using reverse communication. * */ 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 DRSINT1R:\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] = 6; Iopt[5] = 0; sint1( a, b, &answer, work, iopt ); L_30: ; sinta( &answer, work, iopt ); if (Iopt[1] == 0) { answer = sinf( Work[1] ); goto L_30; } 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 */