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

◆ elem_text_out()

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

Definition at line 6 of file aring-CC.cpp.

11{
12 if (p_plus && (ap.re > 0 || (ap.re == 0 && ap.im > 0)))
13 o << "+";
14
15 if (p_parens && ap.re != 0 && ap.im != 0) {
16 if (ap.re < 0) {
17 ElementType neg;
18
19 init(neg);
20 negate(neg, ap);
21 o << "-(" << &neg << ")";
22 clear(neg);
23 } else {
24 o << "(" << &ap << ")";
25 }
26 } else {
27 if (!p_one && ap.re == -1 && ap.im == 0)
28 o << "-";
29 else if (p_one || ap.re != 1 || ap.im != 0)
30 o << &ap;
31 }
32}
void negate(ElementType &result, const ElementType &a) const
Definition aring-CC.hpp:228
elem ElementType
Definition aring-CC.hpp:81
void init(ElementType &result) const
Definition aring-CC.hpp:150
static void clear(ElementType &result)
Definition aring-CC.hpp:164

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