/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:33:20 */
/*FOR_C Options SET: ftn=u io=c no=p op=aimnv pf=,p_szero s=dbov str=l x=f - prototypes */
#include <math.h>
#include "fcrt.h"
#include <stdio.h>
#include <stdlib.h>
#include "p_szero.h"
/*     program DRSZERO
 *>> 1995-05-28 DRSZERO  Krogh  Changes to use M77CON
 *>> 1993-05-05 DRSZERO  Krogh  Adjusted to simplify conversion to C.
 *>> 1992-03-24 DRSZERO  Krogh  Added "," to format statmement.
 *>> 1991-11-25 DRSZERO  Krogh  Cleaned up Fortran version.
 *>> 1987-12-09 DRSZERO  Krogh  Initial Code.
 *--S replaces "?": DR?ZERO, ?ZERO
 *     Demo driver for SZERO.  Univariate zero finder.
 *     F. T. Krogh, Sept. 1987.
 *     ------------------------------------------------------------------ */
		/* PARAMETER translations */
#define	A	0.0e0
#define	B	4.0e0
#define	EIGHT	8.0e0
#define	TOL	0.0e0
#define	TWO	2.0e0
		/* end of PARAMETER translations */
 
 
int main( )
{
	long int mode;
	float f1, f2, x1, x2;
 
	/*     ------------------------------------------------------------------ */
	printf(" DRSZERO.. Demo driver for SZERO, univariate zero finder.\n "
	   "Problem: Find zero of 2**X - 8.   Exact result: X = 3.\n");
	x2 = B;
	f2 = powf(TWO,x2) - EIGHT;
	mode = 0;
	x1 = A;
L_20:
	f1 = powf(TWO,x1) - EIGHT;
	szero( &x1, &f1, &x2, &f2, &mode, TOL );
	if (mode == 1)
		goto L_20;
	printf(" Results from subroutine SZERO:\n    MODE = %3ld\n    Solution:        X1 = %11.8f\n                  f(X1) = %11.3g\n    Accuracy:   X1 - X2 = %11.3g\n                  f(X2) = %11.3g\n",
	   mode, x1, f1, x1 - x2, f2);
	exit(0);
} /* end of function */