// Sub sets f = x - y and returns f. func (f *Float) Sub(x, y *Float) *Float { x.doinit() y.doinit() f.doinit() C.mpf_sub(&f.i[0], &x.i[0], &y.i[0]) return f }
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 }
func (f *Float) Sub(x, y *Float) *Float { C.mpf_sub(&f.i[0], &x.i[0], &y.i[0]) return f }