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

◆ TEST() [7/7]

TEST ( ARingRRi ,
subtract  )

Definition at line 149 of file ARingRRiTest.cpp.

150{
151 M2::ARingRRi R(100);
152 M2::ARingRRR S(100);
154 M2::ARingRRi::ElementType a, b, c, e;
155 R.init(a);
156 R.init(b);
157 R.init(c);
158 R.init(e);
159
161 S.init(f);
162 for (int i = 0; i < ntrials; i++)
163 {
164 // test: (a-b) + (b) == a
165 gen.nextElement(a);
166 gen.nextElement(b);
167 R.subtract(c, a, b);
168 R.add(e, c, b); // should be a
169 EXPECT_TRUE(R.is_subset(a,e));
170 R.mult(e, a, b);
171 R.subtract_multiple(e, a, b);
172 R.midpoint(f,e);
173 EXPECT_TRUE(S.is_zero(f));
174 }
175 S.clear(f);
176 R.clear(e);
177 R.clear(c);
178 R.clear(b);
179 R.clear(a);
180}
const int ntrials
Definition ARingTest.hpp:42
aring-style adapter for arbitrary-precision real numbers, backed by MPFR.
Definition aring-RRR.hpp:70
aring-style adapter for arbitrary-precision real intervals, backed by MPFI.
Definition aring-RRi.hpp:69

References M2::ARingRRi::add(), M2::ARingRRi::clear(), M2::ARingRRR::clear(), M2::ARingRRi::init(), M2::ARingRRR::init(), M2::ARingRRi::is_subset(), M2::ARingRRR::is_zero(), M2::ARingRRi::midpoint(), M2::ARingRRi::mult(), ARingElementGenerator< RingType >::nextElement(), ntrials, M2::ARingRRi::subtract(), subtract(), and M2::ARingRRi::subtract_multiple().