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

◆ TEST() [1/7]

TEST ( ARingCCC ,
add  )

Definition at line 109 of file ARingCCCTest.cpp.

110{
111 M2::ARingCCC C(100);
113 M2::ARingCCC::ElementType a, b, c, d, e;
114 C.init(a);
115 C.init(b);
116 C.init(c);
117 C.init(d);
118 C.init(e);
119 for (int i = 0; i < ntrials; i++)
120 {
121 // test: (a+b) + (-b) == a
122 gen.nextElement(a);
123 gen.nextElement(b);
124 C.add(c, a, b);
125 C.negate(d, b);
126 C.add(e, c, d); // should be a
127 EXPECT_TRUE(almostEqual(C, 98, a, e));
128 }
129 C.clear(e);
130 C.clear(d);
131 C.clear(c);
132 C.clear(b);
133 C.clear(a);
134}
bool almostEqual(const M2::ARingCCC &C, int nbits, const M2::ARingCCC::ElementType &a, const M2::ARingCCC::ElementType &b)
const int ntrials
Definition ARingTest.hpp:42
aring-style adapter for arbitrary-precision complex numbers, stored as (MPFR, MPFR) pairs.
Definition aring-CCC.hpp:71

References M2::ARingCCC::add(), almostEqual(), M2::ARingCCC::clear(), M2::ARingCCC::init(), M2::ARingCCC::negate(), ARingElementGenerator< RingType >::nextElement(), and ntrials.