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

◆ elem_text_out()

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

Definition at line 21 of file aring-zz-gmp.cpp.

26{
27 char* str;
28
29 (void) p_parens;
30 bool is_neg = (mpz_cmp_si(&a, 0) == -1);
31 bool is_one = (mpz_cmp_si(&a, 1) == 0 || mpz_cmp_si(&a, -1) == 0);
32
33 if (!is_neg && p_plus) o << '+';
34 if (is_one)
35 {
36 if (is_neg) o << '-';
37 if (p_one) o << '1';
38 }
39 else
40 {
41 str = mpz_get_str(static_cast<char*>(nullptr), 10, &a);
42 o << str;
43 delete str;
44 }
45}