Macaulay2 Engine
Loading...
Searching...
No Matches
aring-CC.cpp
Go to the documentation of this file.
1#include "aring-CC.hpp"
2
3namespace M2 {
4
5void ARingCC::text_out(buffer &o) const { o << "ACC_53"; }
7 const ElementType &ap,
8 bool p_one,
9 bool p_plus,
10 bool p_parens) const
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}
33
34}; // end namespace M2
35
36// Local Variables:
37// compile-command: "make -C $M2BUILDDIR/Macaulay2/e "
38// indent-tabs-mode: nil
39// End:
M2::ARingCC — machine-precision complex numbers (pair of doubles).
void text_out(buffer &o) const
Definition aring-CC.cpp:5
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
void elem_text_out(buffer &o, const ElementType &a, bool p_one=true, bool p_plus=false, bool p_parens=false) const
Definition aring-CC.cpp:6
static void clear(ElementType &result)
Definition aring-CC.hpp:164
Definition aring-CC.cpp:3