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

◆ displayCoefficient()

template<typename T>
void BasicPoly::displayCoefficient ( std::ostream & o,
T val,
bool print_plus,
bool print_one )
static

Definition at line 56 of file BasicPoly.cpp.

57{
58 // print_one is true: if value is +1 or -1, then print the "1", else don't.
59 bool is_negative = (val < 0);
60 bool is_one = (val == 1 or val == -1);
61
62 if (not is_negative and print_plus) o << '+';
63 if (is_one)
64 {
65 if (is_negative) o << '-';
66 if (print_one) o << '1';
67 }
68 else
69 {
70 o << val;
71 }
72
73}

References T.

Referenced by display().