Logo GNU
Kodovani P°edchozφ Nßsledujφcφ Obsah

34. Testovacφ program pro C

static long maxiter=10000000;
typedef long double number_t;
static int mand_calc(register number_t cre,
                     register number_t cim,
                     register number_t pre,
                     register number_t pim)
{
    register number_t rp = 0, ip = 0;
    register unsigned long iter = maxiter;
    register number_t zre, zim;
    zre = cre;
    zim = cim;
    while ((iter) && (rp + ip < 4)) {
            ip = (zim * zim);
            zim = (zim * zre) * 2 + pim;
            rp = (zre * zre);
            zre = rp - ip + pre;
            iter--;

        }
    iter = maxiter - iter;
    return(iter);
}
main()
{clock_t t1,t2;
  int i;
   t1=clock();
   i=mand_calc(0,0,0,0);
   t2=clock();
   printf("Mloops:%f",((double)maxiter)/(t2-t1)*CLOCKS_PER_SEC);
   return(i);
}


P°edchozφ Nßsledujφcφ Obsah

Dotazy a p°ipomφnky ohledn∞ strßnky posφlejte na hubicka@paru.cas.cz