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

◆ almostEqual()

bool almostEqual ( const RingRRR * R,
int nbits,
ring_elem a,
ring_elem b )

Definition at line 38 of file RingRRRTest.cpp.

39{
40 mpfr_t epsilon;
41 mpfr_init2(epsilon, 100);
42 mpfr_set_ui_2exp(epsilon, 1, -nbits, MPFR_RNDN);
43
44 ring_elem c = R->subtract(a, b);
45 bool ret = mpfr_cmpabs(c.get_mpfr(), epsilon) < 0;
46
47 mpfr_clear(epsilon);
48 return ret;
49}
virtual ring_elem subtract(const ring_elem f, const ring_elem g) const
mpfr_srcptr get_mpfr() const
Definition ringelem.hpp:130

References ring_elem::get_mpfr(), and M2::ConcreteRing< RingType >::subtract().

Referenced by TEST(), TEST(), TEST(), TEST(), and TEST().