int
main ()
{ int i, nerrors; double complex (*fun1) (double complex); double complex (*fun2) (double complex, double complex); double complex e;
nerrors = 0; for (i = 0; ; i++)
{ if (test1[i].name == 0 || test1[i].func == 0) break;
x1 = test1[i].arg1;
fun1 = test1[i].func;
cy = (*(fun1)) (x1);
answer = test1[i].answer; if (memcmp ((void *) &cy, (void *) &answer, sizeof (double complex))
== 0) continue; /* answer is ok */
#if0 /* Check sign bits, in case of minus zero. */ if (signbit (creal (cy)) != signbit (creal (answer)))
{ /* If they are both NaN's, forget about the sign bits. */ if (isnan (creal (cy)) && isnan (creal (answer))) goto srealok;
printf ("%d Sign bit of real part differs.\n", i); goto err1;
}
srealok: if (signbit (cimag (cy)) != signbit (cimag (answer)))
{ /* If they are both NaN's, forget about the sign bits. */ if (isnan (cimag (cy)) && isnan (cimag (answer))) goto simagok;
printf ("%d Sign bit of imaginary part differs.\n", i); goto err1;
}
simagok: #endif
if (cy != answer)
{
e = cy - answer; if (answer != 0.0)
e = e / answer; if (cabs(e) > test1[i].thresh * MACHEP)
{ #if0
err1: #endif
printf ( "%d %s (%.16e,%.16e) = (%.16e,%.16e)\n should be. (%.16e,%.16e)\n",
i, test1[i].name, creal(x1), cimag(x1),
creal(cy), cimag(cy), creal(answer), cimag(answer));
pchex ((void *) &x1);
pchex ((void *) &cy);
pchex ((void *) &answer);
nerrors += 1;
}
}
}
for (i = 0; ; i++)
{ if (test2[i].name == 0 || test2[i].func == 0) break;
x1 = test2[i].arg1;
x2 = test2[i].arg2;
fun2 = test2[i].func;
cy = (*(fun2)) (x1, x2);
answer = test2[i].answer; if (memcmp ((void *) &cy, (void *) &answer, sizeof (double complex))
== 0) continue; /* answer is ok */ #if0 if (signbit (creal (cy)) != signbit (creal (answer)))
{
printf ("%d Sign bit of real part differs.\n", i); goto err1;
} if (signbit (cimag (cy)) != signbit (cimag (answer)))
{
printf ("%d Sign bit of imaginary part differs.\n", i); goto err1;
} #endif if (cy != answer)
{
e = cy - answer; if (answer != 0.0)
e = e / answer; /* if(e<0) e=-e;
*/ if (cabs(e) > test2[i].thresh * MACHEP)
{
printf ("%s ((%.16e,%.16e), (%.16e,%.16e))",
test2[i].name, creal(x1), cimag(x1), creal(x2), cimag(x2));
printf (" = (%.16e,%.16e), should be (%.16e,%.16e)\n",
creal(cy), cimag(cy), creal(answer), cimag(answer));
nerrors += 1;
}
}
}
printf ("%d errors\n", nerrors); exit (0);
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 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.