static void _fastcall zmo_calcbf(bf_t bfdx, bf_t bfdy, bf_t bfnewx, bf_t bfnewy,bf_t bfplotmx1, bf_t bfplotmx2, bf_t bfplotmy1, bf_t bfplotmy2, bf_t bfftemp) { bf_t btmp1, btmp2, btmp3, btmp4, btempx, btempy ; bf_t btmp2a, btmp4a; int saved; saved = save_stack(); btmp1 = alloc_stack(rbflength+2); btmp2 = alloc_stack(rbflength+2); btmp3 = alloc_stack(rbflength+2); btmp4 = alloc_stack(rbflength+2); btmp2a = alloc_stack(rbflength+2); btmp4a = alloc_stack(rbflength+2); btempx = alloc_stack(rbflength+2); btempy = alloc_stack(rbflength+2); /* calc cur screen corner relative to zoombox, when zoombox co-ords are taken as (0,0) topleft thru (1,1) bottom right */ /* tempx = dy * plotmx1 - dx * plotmx2; */ mult_bf(btmp1,bfdy,bfplotmx1); mult_bf(btmp2,bfdx,bfplotmx2); sub_bf(btempx,btmp1,btmp2); /* tempy = dx * plotmy1 - dy * plotmy2; */ mult_bf(btmp1,bfdx,bfplotmy1); mult_bf(btmp2,bfdy,bfplotmy2); sub_bf(btempy,btmp1,btmp2); /* calc new corner by extending from current screen corners */ /* *newx = sxmin + tempx*(sxmax-sx3rd)/ftemp + tempy*(sx3rd-sxmin)/ftemp; */ sub_bf(btmp1,bfsxmax,bfsx3rd); mult_bf(btmp2,btempx,btmp1); /* show_three_bf("fact1",btempx,"fact2",btmp1,"prod ",btmp2,70); */ div_bf(btmp2a,btmp2,bfftemp); /* show_three_bf("num ",btmp2,"denom",bfftemp,"quot ",btmp2a,70); */ sub_bf(btmp3,bfsx3rd,bfsxmin); mult_bf(btmp4,btempy,btmp3); div_bf(btmp4a,btmp4,bfftemp); add_bf(bfnewx,bfsxmin,btmp2a); add_a_bf(bfnewx,btmp4a); /* *newy = symax + tempy*(sy3rd-symax)/ftemp + tempx*(symin-sy3rd)/ftemp; */ sub_bf(btmp1,bfsy3rd,bfsymax); mult_bf(btmp2,btempy,btmp1); div_bf(btmp2a,btmp2,bfftemp); sub_bf(btmp3,bfsymin,bfsy3rd); mult_bf(btmp4,btempx,btmp3); div_bf(btmp4a,btmp4,bfftemp); add_bf(bfnewy,bfsymax,btmp2a); add_a_bf(bfnewy,btmp4a); restore_stack(saved); }
int JuliabfFractal() { // new.x = tmpsqrx - tmpsqry + parm.x; sub_a_bf(bftmpsqrx, bftmpsqry); add_bf(bfnew.x, bftmpsqrx, bfparm.x); // new.y = 2 * bfold.x * bfold.y + parm.y; mult_bf(bftmp, bfold.x, bfold.y); // ok to use unsafe here double_a_bf(bftmp); add_bf(bfnew.y, bftmp, bfparm.y); return bigfltbailout(); }
int JuliaZpowerbfFractal() { BFComplex parm2; int saved; saved = save_stack(); parm2.x = alloc_stack(bflength+2); parm2.y = alloc_stack(bflength+2); floattobf(parm2.x, param[2]); floattobf(parm2.y, param[3]); ComplexPower_bf(&bfnew, &bfold, &parm2); add_bf(bfnew.x, bfparm.x, bfnew.x); add_bf(bfnew.y, bfparm.y, bfnew.y); restore_stack(saved); return bigfltbailout(); }
int bfMODbailout() { long longmagnitude; square_bf(bftmpsqrx, bfnew.x); square_bf(bftmpsqry, bfnew.y); add_bf(bftmp, bftmpsqrx, bftmpsqry); longmagnitude = bftoint(bftmp); if (longmagnitude >= (long)rqlim) return 1; copy_bf(bfold.x, bfnew.x); copy_bf(bfold.y, bfnew.y); return 0; }
BFComplex *cplxmul_bf(BFComplex *t, BFComplex *x, BFComplex *y) { bf_t tmp1; int saved; saved = save_stack(); tmp1 = alloc_stack(rbflength+2); mult_bf(t->x, x->x, y->x); mult_bf(t->y, x->y, y->y); sub_bf(t->x, t->x, t->y); mult_bf(tmp1, x->x, y->y); mult_bf(t->y, x->y, y->x); add_bf(t->y, tmp1, t->y); restore_stack(saved); return (t); }
int bfMANRbailout() { long longtempmag; square_bf(bftmpsqrx, bfnew.x); square_bf(bftmpsqry, bfnew.y); add_bf(bftmp, bfnew.x, bfnew.y); // don't need abs since we square it next // note: in next two lines, bfold is just used as a temporary variable square_bf(bfold.x, bftmp); longtempmag = bftoint(bfold.x); if (longtempmag >= (long)rqlim) return 1; copy_bf(bfold.x, bfnew.x); copy_bf(bfold.y, bfnew.y); return (0); }
/* big number declarations */ void calc_corner(bf_t target,bf_t p1,double p2,bf_t p3,double p4,bf_t p5) { bf_t btmp1, btmp2 ,btmp3; int saved; saved = save_stack(); btmp1 = alloc_stack(rbflength+2); btmp2 = alloc_stack(rbflength+2); btmp3 = alloc_stack(rbflength+2); /* use target as temporary variable */ floattobf(btmp3, p2); mult_bf(btmp1,btmp3,p3); mult_bf(btmp2,floattobf(target, p4),p5); add_bf(target,btmp1,btmp2); add_a_bf(target,p1); restore_stack(saved); }
int bfMANHbailout() { long longtempmag; square_bf(bftmpsqrx, bfnew.x); square_bf(bftmpsqry, bfnew.y); // note: in next five lines, bfold is just used as a temporary variable abs_bf(bfold.x, bfnew.x); abs_bf(bfold.y, bfnew.y); add_bf(bftmp, bfold.x, bfold.y); square_bf(bfold.x, bftmp); longtempmag = bftoint(bfold.x); if (longtempmag >= (long)rqlim) return 1; copy_bf(bfold.x, bfnew.x); copy_bf(bfold.y, bfnew.y); return (0); }