47 #define comp_init(d, prec) mpfr_init2((d)->x, prec); \
48 mpfr_init2((d)->y, prec);
51 #define comp_initz(d, prec) mpfr_init2((d)->x, prec); \
52 mpfr_init2((d)->y, prec); \
53 mpfr_set_zero((d)->x, 1); \
54 mpfr_set_zero((d)->y, 1);
57 #define comp_clear(d) mpfr_clear((d)->x); \
61 #define comp_zero(d) (mpfr_zero_p((d)->x) && mpfr_zero_p((d)->y))
64 #define comp_add(d, a, b) mpfr_add((d)->x, (a)->x, (b)->x, MPFR_RNDN); \
65 mpfr_add((d)->y, (a)->y, (b)->y, MPFR_RNDN);
68 #define comp_set(d, a) mpfr_set((d)->x, (a)->x, MPFR_RNDN); \
69 mpfr_set((d)->y, (a)->y, MPFR_RNDN);
72 #define comp_setr(d, a) mpfr_set((d)->x, (a), MPFR_RNDN); \
73 mpfr_set_zero((d)->y, 1);
76 #define comp_neg(d, a) mpfr_neg((d)->x, (a)->x, MPFR_RNDN); \
77 mpfr_neg((d)->y, (a)->y, MPFR_RNDN);
80 #define comp_addr(d, a, r) mpfr_add((d)->x, (a)->x, (r), MPFR_RNDN); \
81 mpfr_set((d)->y, (a)->y, MPFR_RNDN);
84 #define comp_amu(d, a, r, buf) mpfr_mul_ui((buf), (a)->x, (r), MPFR_RNDN); \
85 mpfr_add((d)->x, (d)->x, (buf), MPFR_RNDN); \
86 mpfr_mul_ui((buf), (a)->y, (r), MPFR_RNDN); \
87 mpfr_add((d)->y, (d)->y, (buf), MPFR_RNDN);
90 #define comp_sub(d, a, b) mpfr_sub((d)->x, (a)->x, (b)->x, MPFR_RNDN); \
91 mpfr_sub((d)->y, (a)->y, (b)->y, MPFR_RNDN);
94 #define comp_subr(d, a, r) mpfr_sub((d)->x, (a)->x, (r), MPFR_RNDN); \
95 mpfr_set((d)->y, (a)->y, MPFR_RNDN);
98 #define comp_mul(d, a, b, buf1, buf2) mpfr_mul((buf1), (a)->x, (b)->x, MPFR_RNDN); \
99 mpfr_mul((buf2), (a)->y, (b)->y, MPFR_RNDN); \
100 mpfr_sub((buf1), (buf1), (buf2), MPFR_RNDN); \
101 mpfr_mul((buf2), (a)->x, (b)->y, MPFR_RNDN); \
102 mpfr_mul((d)->y, (a)->y, (b)->x, MPFR_RNDN); \
103 mpfr_add((d)->y, (d)->y, (buf2), MPFR_RNDN); \
104 mpfr_set((d)->x, (buf1), MPFR_RNDN);
107 #define comp_div(d, a, b, b1, b2, b3) mpfr_sqr((b3), (b)->x, MPFR_RNDN); \
108 mpfr_sqr((b2), (b)->y, MPFR_RNDN); \
109 mpfr_add((b3), (b3), (b2), MPFR_RNDN); \
110 mpfr_mul((b1), (a)->x, (b)->x, MPFR_RNDN); \
111 mpfr_mul((b2), (a)->y, (b)->y, MPFR_RNDN); \
112 mpfr_add((b1), (b1), (b2), MPFR_RNDN); \
113 mpfr_mul((b2), (a)->x, (b)->y, MPFR_RNDN); \
114 mpfr_mul((d)->y, (a)->y, (b)->x, MPFR_RNDN); \
115 mpfr_sub((d)->y, (d)->y, (b2), MPFR_RNDN); \
116 mpfr_div((d)->y, (d)->y, (b3), MPFR_RNDN); \
117 mpfr_div((d)->x, (b1), (b3), MPFR_RNDN);
120 #define comp_mod(m, a) mpfr_hypot((m), (a)->x, (a)->y, MPFR_RNDN);
123 #define comp_mulr(d, a, r) mpfr_mul((d)->x, (a)->x, (r), MPFR_RNDN); \
124 mpfr_mul((d)->y, (a)->y, (r), MPFR_RNDN);
127 #define comp_muli(d, a, i) mpfr_mul_si((d)->x, (a)->x, (i), MPFR_RNDN); \
128 mpfr_mul_si((d)->y, (a)->y, (i), MPFR_RNDN);
131 #define comp_mulu(d, a, i) mpfr_mul_ui((d)->x, (a)->x, (i), MPFR_RNDN); \
132 mpfr_mul_ui((d)->y, (a)->y, (i), MPFR_RNDN);
135 #define comp_sqr(d, a, buf) mpfr_sqr((buf), (a)->y, MPFR_RNDN); \
136 mpfr_mul((d)->y, (a)->x, (a)->y, MPFR_RNDN); \
137 mpfr_mul_2si((d)->y, (d)->y, 1, MPFR_RNDN); \
138 mpfr_sqr((d)->x, (a)->x, MPFR_RNDN); \
139 mpfr_sub((d)->x, (d)->x, (buf), MPFR_RNDN);
real_t comp_log2(comp z)
Computes the base 2 log of |z|.
real_t real_log2(mpfr_t x)
Computes the base 2 log of |x|.
comp_struct * comp_ptr
Convenience pointer to comp_struct.
real_t mpfr_s(mpfr_t x)
Computes s(x).
real_t comp_s(comp z)
Computes s(z).
comp_struct comp[1]
Practical wrapper for comp_struct.
Definition of basic types.
double real_t
The machine number type to use for polynomial analysis and preconditionning.
Multi-precision floating point complex numbers.
mpfr_t x
the real part of the complex number
mpfr_t y
the imaginary part of the complex number