#include #include #include int main (int argc, char *argv[]) { double x1, x2; double p, q; double epsm, cond; x1 = 1.0; printf ("x1 esatto = %20.18lf\n", x1); x2 = 1.0 + 1.0/(7*7*7*7*7); p = (x1 + x2)/2.0; q = x1 * x2; x1 = p - sqrt (p*p - q); printf ("(alg 1) x1 = %20.18lf\n", x1); x1 = q/(p + sqrt (p*p - q)); printf ("(alg 2) x1 = %20.18lf\n", x1); epsm = 1.07309e-16; cond = 2/sqrt(p*p-q); printf ("Indice di condizionamento circa K = %lg\n", cond); printf ("Errore atteso: K*%20.18lf =\n", epsm); printf (" %20.18lf\n", epsm*cond); return (0); }