Lines Matching refs:ctx
65 color_point(const mpd_t *x0, const mpd_t *y0, const long maxiter, mpd_context_t *ctx)
73 mpd_set_u32(x, 0, ctx);
74 mpd_set_u32(y, 0, ctx);
78 mpd_set_u32(sq_x, 0, ctx);
79 mpd_set_u32(sq_y, 0, ctx);
83 mpd_set_u32(two, 2, ctx);
84 mpd_set_u32(four, 4, ctx);
87 mpd_set_u32(c, 0, ctx);
89 for (i = 0; i < maxiter && mpd_cmp(c, four, ctx) <= 0; i++) {
90 mpd_mul(y, x, y, ctx);
91 mpd_mul(y, y, two, ctx);
92 mpd_add(y, y, y0, ctx);
94 mpd_sub(x, sq_x, sq_y, ctx);
95 mpd_add(x, x, x0, ctx);
97 mpd_mul(sq_x, x, x, ctx);
98 mpd_mul(sq_y, y, y, ctx);
99 mpd_add(c, sq_x, sq_y, ctx);
116 mpd_context_t ctx;
134 mpd_init(&ctx, prec);
143 mpd_set_u32(sqrt_2, 2, &ctx);
144 mpd_sqrt(sqrt_2, sqrt_2, &ctx);
145 mpd_div_u32(xstep, sqrt_2, 40, &ctx);
146 mpd_div_u32(ystep, sqrt_2, 20, &ctx);
149 mpd_copy(y0, sqrt_2, &ctx);
151 mpd_copy(x0, sqrt_2, &ctx);
154 points[i][j] = color_point(x0, y0, iter, &ctx);
155 mpd_add(x0, x0, xstep, &ctx);
157 mpd_sub(y0, y0, ystep, &ctx);