51 #define compf_set(d, a) (d)->x = (a)->x; \
55 #define compf_setr(d, a) (d)->x = (a); \
59 #define compf_neg(d, a) (d)->x = -(a)->x; \
63 #define compf_add(d, a, b) (d)->x = (a)->x + (b)->x; \
64 (d)->y = (a)->y + (b)->y;
67 #define compf_addr(d, a, r) (d)->x = (a)->x + (r); \
71 #define compf_sub(d, a, b) (d)->x = (a)->x - (b)->x; \
72 (d)->y = (a)->y - (b)->y;
75 #define compf_subr(d, a, r) (d)->x = (a)->x - (r); \
78 #define compf_mul(d, a, b) coeff_t px = (a)->x * (b)->x - (a)->y * (b)->y; \
79 (d)->y = (a)->x * (b)->y + (a)->y * (b)->x; \
83 #define compf_mulr(d, a, r) (d)->x = (a)->x * (r); \
84 (d)->y = (a)->y * (r);
87 #define compf_amr(d, a, r) (d)->x += (a)->x * (r); \
88 (d)->y += (a)->y * (r);
91 #define compf_sqr(d, a) coeff_t px = (a)->x * (a)->x - (a)->y * (a)->y; \
92 (d)->y = 2 * (a)->x * (a)->y; \
96 #define compf_div(d, a, b) { \
97 coeff_t m2 = compf_mod2(b); \
98 coeff_t px = ((a)->x * (b)->x + (a)->y * (b)->y) / m2; \
99 (d)->y = ((a)->y * (b)->x - (a)->x * (b)->y) / m2; \
104 #define compf_mod(a) fhypot((a)->x, (a)->y)
107 #define compf_dist(a, b) fhypot((a)->x - (b)->x, (a)->y - (b)->y)
111 #define compf_mod2(a) ((a)->x * (a)->x + (a)->y * (a)->y)
114 #define compf_log2(a) (plog2(compf_mod(a)))
117 #define coeff_log2(a) (plog2((a) < 0 ? -(a) : (a)))
120 #define compf_s(a) (pfloor(plog2(compf_mod(a))) + 1)
123 #define coeff_s(a) (pfloor(coeff_log2(a)) + 1)
compf_struct compf[1]
Practical wrapper for compf_struct.
compf_struct * compf_ptr
Convenience pointer to compf_struct.
Definition of basic types.
double coeff_t
The machine number type to use for polynomial coefficients and evaluation.
coeff_t y
the imaginary part of the complex number
coeff_t x
the real part of the complex number