Macaulay2 Engine
Loading...
Searching...
No Matches

◆ elem_text_out()

void M2::ARingCCC::elem_text_out ( buffer & o,
const ElementType & a,
bool p_one = true,
bool p_plus = false,
bool p_parens = false ) const

Definition at line 7 of file aring-CCC.cpp.

12{
13 if (p_plus && (mpfr_cmp_si(&f.re, 0) > 0 ||
14 (mpfr_cmp_si(&f.re, 0) == 0 && mpfr_cmp_si(&f.im, 0) > 0)))
15 o << "+";
16
17 if (p_parens && mpfr_cmp_si(&f.re, 0) != 0 && mpfr_cmp_si(&f.im, 0) != 0) {
18 if (mpfr_cmp_si(&f.re, 0) < 0) {
19 ElementType neg;
20
21 init(neg);
22 negate(neg, f);
23 o << "-(" << &neg << ")";
24 clear(neg);
25 } else {
26 o << "(" << &f << ")";
27 }
28 } else {
29 if (!p_one && mpfr_cmp_si(&f.re, -1) == 0 && mpfr_cmp_si(&f.im, 0) == 0)
30 o << "-";
31 else if (p_one || mpfr_cmp_si(&f.re, 1) != 0 || mpfr_cmp_si(&f.im, 0) != 0)
32 o << &f;
33 }
34}
void init(ElementType &result) const
void negate(ElementType &result, const ElementType &a) const
static void clear(ElementType &result)

References clear(), cc_struct::im, init(), negate(), and cc_struct::re.