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

◆ testDivide()

template<typename T>
void testDivide ( const T & R,
int ntrials )

Definition at line 340 of file ARingTest.hpp.

341{
343 typename T::ElementType a, b, c, d, zero;
344 R.init(a);
345 R.init(b);
346 R.init(c);
347 R.init(d);
348 R.init(zero);
349 R.set_from_long(zero, 0);
350 for (int i = 0; i < ntrials; i++)
351 {
352 // c = a*b
353 // c//a == b
354 gen.nextElement(a);
355 gen.nextElement(b);
356 gen.nextElement(c);
357 gen.nextElement(d);
358 if (R.is_zero(a)) continue;
359 R.mult(c, a, b);
360 R.divide(d, c, a);
361 EXPECT_TRUE(R.is_equal(b, d));
362 }
363 R.clear(a);
364 R.clear(b);
365 R.clear(c);
366 R.clear(d);
367 R.clear(zero);
368}
const int ntrials
Definition ARingTest.hpp:42
int zero

References ARingElementGenerator< RingType >::nextElement(), ntrials, T, and zero.