func DoMandel(cr, ci, zr, zi *Float, iterations int) int { C.mpf_set(&x[0], &zr.i[0]) C.mpf_set(&y[0], &zi.i[0]) C.mpf_set(&cx[0], &cr.i[0]) C.mpf_set(&cy[0], &ci.i[0]) for i := 0; ; i++ { C.mpf_mul(&a[0], &x[0], &x[0]) C.mpf_mul(&b[0], &y[0], &y[0]) if float64(C.mpf_get_d(&a[0]))+float64(C.mpf_get_d(&b[0])) > 4.0 { return i } if i == iterations-1 { break } C.mpf_mul_2exp(&y[0], &y[0], 1) C.mpf_mul(&y[0], &y[0], &x[0]) C.mpf_add(&y[0], &y[0], &cy[0]) C.mpf_sub(&x[0], &a[0], &b[0]) //todo C.mpf_add(&x[0], &x[0], &cx[0]) } return iterations }
// Set sets f = x and returns f. func (f *Float) Set(x *Float) *Float { f.doinit() C.mpf_set(&f.i[0], &x.i[0]) return f }
// Set sets f = x and returns f. func (f *Float) Set(x *Float) *Float { C.mpf_set(&f.i[0], &x.i[0]) return f }