home *** CD-ROM | disk | FTP | other *** search
- plycfc(p,s,ndp,nds,c,ndc)
-
- /*this function finds the greatest common divisor of two */
- /*polynomials of the form: */
- /*a(1)x**nda + a(2)x**(nda-1) + ... + a(nda)x + a(nda+1) */
- /*by a series of divisions until a remainder of zero is found */
-
- int ndp,nds,*ndc;
- float p[],s[],c[];
-
- {
- int ijk,m,n,ndq,ndcc;
- float q[1];
- float xx;
- extern double fabs();
-
- /* while(fabs(xx) <= 0.000005 && ndcc == 0) */
-
- n = ndp;
- l2: q[0] = 999999.;
- plydiv(p,s,ndp,nds,q,c,ndq,&ndcc);
-
- xx = c[0] / s[0];
- if (fabs(xx) <= 0.000005 && ndcc == 0) goto l21;
- ndp = nds;
- nds = ndcc;
- for(m = 0; m <= ndp; m++)
- p[m] = s[m];
-
- for(n = 0; n <= nds; n++)
- s[n] = c[n];
-
- goto l2;
- l21: ndcc = nds;
- for(n = 0; n <= ndcc; n++)
- c[n] = s[n];
- *ndc = ndcc;
- }