/* Maximum degree of polynomial. */ int MAXPOLF = 0; externint MAXPOLF;
/* Number of bytes (chars) in maximum size polynomial. */ staticint psize = 0;
/* Initialize max degree of polynomials *andallocatetemporarystorage.
*/ #ifdef ANSIC void polinif( int maxdeg ) #else int polinif( maxdeg ) int maxdeg; #endif
{
/* Allocate new arrays */
pt1 = (float * )malloc(psize); /* used by polsbt */
pt2 = (float * )malloc(psize); /* used by polsbt */
pt3 = (float * )malloc(psize); /* used by polmul */
/* Set b = a.
*/ #ifdef ANSIC void polmovf( registerfloat *a, int na, registerfloat *b ) #else int polmovf( a, na, b ) registerfloat *a, *b; int na; #endif
{ int i;
/* c = b * a.
*/ #ifdef ANSIC void polmulf( float a[], int na, float b[], int nb, float c[] ) #else int polmulf( a, na, b, nb, c ) float a[], b[], c[]; int na, nb; #endif
{ int i, j, k, nc; float x;
nc = na + nb;
polclrf( pt3, MAXPOLF );
for( i=0; i<=na; i++ )
{
x = a[i]; for( j=0; j<=nb; j++ )
{
k = i + j; if( k > MAXPOLF ) break;
pt3[k] += x * b[j];
}
}
/* c = b + a.
*/ #ifdef ANSIC void poladdf( float a[], int na, float b[], int nb, float c[] ) #else int poladdf( a, na, b, nb, c ) float a[], b[], c[]; int na, nb; #endif
{ int i, n;
if( na > nb )
n = na; else
n = nb;
if( n > MAXPOLF )
n = MAXPOLF;
for( i=0; i<=n; i++ )
{ if( i > na )
c[i] = b[i]; elseif( i > nb )
c[i] = a[i]; else
c[i] = b[i] + a[i];
} #if !ANSIC return0; #endif
}
/* c = b - a.
*/ #ifdef ANSIC void polsubf( float a[], int na, float b[], int nb, float c[] ) #else int polsubf( a, na, b, nb, c ) float a[], b[], c[]; int na, nb; #endif
{ int i, n;
if( na > nb )
n = na; else
n = nb;
if( n > MAXPOLF )
n = MAXPOLF;
for( i=0; i<=n; i++ )
{ if( i > na )
c[i] = b[i]; elseif( i > nb )
c[i] = -a[i]; else
c[i] = b[i] - a[i];
} #if !ANSIC return0; #endif
}
/* c = b/a
*/ #ifdef ANSIC int poldivf( float a[], int na, float b[], int nb, float c[] ) #else int poldivf( a, na, b, nb, c ) float a[], b[], c[]; int na, nb; #endif
{ float quot; float *ta, *tb, *tq; int i, j, k, sing;
sing = 0;
/* Allocate temporary arrays. This would be quicker *ifdoneautomaticallyonthestack,butstackspace *maybehardtoobtainonasmallcomputer.
*/
ta = (float * )malloc( psize );
polclrf( ta, MAXPOLF );
polmovf( a, na, ta );
/* Change of variables *Substitutea(y)forthevariablexinb(x). *x=a(y) *c(x)=b(x)=b(a(y)).
*/
#ifdef ANSIC void polsbt( float a[], int na, float b[], int nb, float c[] ) #else int polsbt( a, na, b, nb, c ) float a[], b[], c[]; int na, nb; #endif
{ int i, j, k, n2; float x;
for( i=1; i<=nb; i++ )
{ /* Form ith power of a. */
polmulf( a, na, pt2, n2, pt2 );
n2 += na;
x = b[i]; /* Add the ith coefficient of b times the ith power of a. */ for( j=0; j<=n2; j++ )
{ if( j > MAXPOLF ) break;
pt1[j] += x * pt2[j];
}
}
k = n2 + nb; if( k > MAXPOLF )
k = MAXPOLF; for( i=0; i<=k; i++ )
c[i] = pt1[i]; #if !ANSIC return0; #endif
}
/* Evaluate polynomial a(t) at t = x.
*/ #ifdef ANSIC float polevaf( float *a, int na, float xx ) #else float polevaf( a, na, xx ) float a[]; int na; double xx; #endif
{ float x, s; int i;
x = xx;
s = a[na]; for( i=na-1; i>=0; i-- )
{
s = s * x + a[i];
} return(s);
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet am 2026-06-17)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.