int
JuliaZpowerbnFractal()
{
    BNComplex parm2;
    int saved;
    saved = save_stack();

    parm2.x = alloc_stack(bnlength);
    parm2.y = alloc_stack(bnlength);

    floattobn(parm2.x, param[2]);
    floattobn(parm2.y, param[3]);
    ComplexPower_bn(&bnnew, &bnold, &parm2);
    add_bn(bnnew.x, bnparm.x, bnnew.x+shiftfactor);
    add_bn(bnnew.y, bnparm.y, bnnew.y+shiftfactor);
    restore_stack(saved);
    return bignumbailout();
}
int
JuliabnFractal()
{
    // Don't forget, with bn_t numbers, after multiplying or squaring
    // you must shift over by shiftfactor to get the bn number.

    // bntmpsqrx and bntmpsqry were previously squared before getting to
    // this function, so they must be shifted.

    // new.x = tmpsqrx - tmpsqry + parm.x;
    sub_a_bn(bntmpsqrx+shiftfactor, bntmpsqry+shiftfactor);
    add_bn(bnnew.x, bntmpsqrx+shiftfactor, bnparm.x);

    // new.y = 2 * bnold.x * bnold.y + parm.y;
    mult_bn(bntmp, bnold.x, bnold.y); // ok to use unsafe here
    double_a_bn(bntmp+shiftfactor);
    add_bn(bnnew.y, bntmp+shiftfactor, bnparm.y);

    return bignumbailout();
}
int  bnMODbailout()
{
    long longmagnitude;

    square_bn(bntmpsqrx, bnnew.x);
    square_bn(bntmpsqry, bnnew.y);
    add_bn(bntmp, bntmpsqrx+shiftfactor, bntmpsqry+shiftfactor);

    longmagnitude = bntoint(bntmp);  // works with any fractal type
    if (longmagnitude >= (long)rqlim)
        return 1;
    copy_bn(bnold.x, bnnew.x);
    copy_bn(bnold.y, bnnew.y);
    return 0;
}
BNComplex *cplxmul_bn(BNComplex *t, BNComplex *x, BNComplex *y)
{
    bn_t tmp1;
    int saved;
    saved = save_stack();
    tmp1 = alloc_stack(rlength);
    mult_bn(t->x, x->x, y->x);
    mult_bn(t->y, x->y, y->y);
    sub_bn(t->x, t->x+shiftfactor, t->y+shiftfactor);

    mult_bn(tmp1, x->x, y->y);
    mult_bn(t->y, x->y, y->x);
    add_bn(t->y, tmp1+shiftfactor, t->y+shiftfactor);
    restore_stack(saved);
    return (t);
}
int  bnMANRbailout()
{
    long longtempmag;

    square_bn(bntmpsqrx, bnnew.x);
    square_bn(bntmpsqry, bnnew.y);
    add_bn(bntmp, bnnew.x, bnnew.y); // don't need abs since we square it next
    // note: in next two lines, bnold is just used as a temporary variable
    square_bn(bnold.x, bntmp);
    longtempmag = bntoint(bnold.x+shiftfactor);
    if (longtempmag >= (long)rqlim)
        return 1;
    copy_bn(bnold.x, bnnew.x);
    copy_bn(bnold.y, bnnew.y);
    return (0);
}
示例#6
0
	t_bignum operator + (const t_bignum& bn) const { return (add_bn(*this, bn));        }