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

◆ almostEqual()

bool almostEqual ( const M2::ARingRRR & R,
int nbits,
const M2::ARingRRR::ElementType & a,
const M2::ARingRRR::ElementType & b )

Definition at line 45 of file ARingRRRTest.cpp.

49{
50 mpfr_t epsilon;
51 mpfr_init2(epsilon, R.get_precision());
52 mpfr_set_ui_2exp(epsilon, 1, -nbits, MPFR_RNDN);
53
55 R.init(c);
56 R.subtract(c, a, b);
57 bool ret = mpfr_cmpabs(&c, epsilon) < 0;
58
59 R.clear(c);
60 mpfr_clear(epsilon);
61 return ret;
62}
void subtract(ElementType &result, const ElementType &a, const ElementType &b) const
static void clear(ElementType &result)
void init(ElementType &result) const
unsigned long get_precision() const
Definition aring-RRR.hpp:82

References M2::ARingRRR::clear(), M2::ARingRRR::get_precision(), M2::ARingRRR::init(), and M2::ARingRRR::subtract().

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