/*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_zcomp s=dbov str=l x=f - prototypes */
#include <math.h>
#include "fcrt.h"
#include <stdio.h>
#include <stdlib.h>
#include "p_zcomp.h"
/*     program DRZCOMP
 *>> 2001-01-24 DRZCOMP  ZSQRT -> ZSQRTX to fix C lib. problems.
 *>> 1998-01-22 DRZCOMP  Krogh Added ZDIF,..., ZSUM to exernal statement.
 *>> 1996-05-28 DRZCOMP  Krogh Added external statement.
 *>> 1993-02-04 CLL Added call to DZABS.
 *>> 1987-12-09 DRZCOMP  Lawson  Initial Code.
 *     Demo driver for DZABS, ZSUM, ZDIF, ZPRO, ZQUO, and ZSQRTX.
 *     C. L. Lawson, JPL, 1987 Feb 17.
 *     ------------------------------------------------------------------ */
 
int main( )
{
	double a[2], b[2], c[2], dmag, test[2], u[2], u2[2], v[2], v2[2],
	 w[2], w2[2], z[2];
		/* OFFSET Vectors w/subscript range: 1 to dimension */
	double *const A = &a[0] - 1;
	double *const B = &b[0] - 1;
	double *const C = &c[0] - 1;
	double *const Test = &test[0] - 1;
	double *const U = &u[0] - 1;
	double *const U2 = &u2[0] - 1;
	double *const V = &v[0] - 1;
	double *const V2 = &v2[0] - 1;
	double *const W = &w[0] - 1;
	double *const W2 = &w2[0] - 1;
	double *const Z = &z[0] - 1;
		/* end of OFFSET VECTORS */
 
	/*     ------------------------------------------------------------------ */
	A[1] = 6.0e0/7.0e0;
	A[2] = -14.0e0/15.0e0;
	B[1] = -29.0e0/31.0e0;
	B[2] = 47.0e0/43.0e0;
	U[1] = 51.0e0/53.0e0;
	U[2] = 73.0e0/71.0e0;
	zsum( u, a, v );
	zpro( v, b, w );
	zsqrtx( w, z );
	zpro( z, z, w2 );
	zquo( w2, b, v2 );
	zdif( v2, a, u2 );
	zdif( u2, u, test );
	C[1] = 3.0e0/7.0e0;
	C[2] = -4.0e0/7.0e0;
	dmag = dzabs( c );
	printf("                             ODZCOMP\n\n");
	printf(" A        = (%19.15f,%19.15f)\n B        = (%19.15f,%19.15f)\n U        = (%19.15f,%19.15f)\n "
	   "V = U+A  = (%19.15f,%19.15f)\n W = V*B  = (%19.15f,%19.15f)\n Z=sqrt(W)= (%19.15f,%19.15f)\n "
	   "W2 = Z*Z = (%19.15f,%19.15f)\n V2= W2/B = (%19.15f,%19.15f)\n U2= V2-A = (%19.15f,%19.15f)\n",
	   A[1], A[2], B[1], B[2], U[1], U[2], V[1], V[2], W[1], W[2], Z[1], Z[2], W2[1],
	   W2[2], V2[1], V2[2], U2[1], U2[2]);
	printf(" TEST=U2-U= (%19.3g,%19.3g)\n", Test[1], Test[2]);
	C[1] = 3.0e0/7.0e0;
	C[2] = -4.0e0/7.0e0;
	dmag = dzabs( c );
	printf("\n C        = (%19.15f,%19.15f)\n", C[1], C[2]);
	printf(" TEST2 = DZABS(C)-(5/7) = %11.3g\n", dmag -	 (5.0e0/7.0e0));
	exit(0);
 
} /* end of function */