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

◆ almostEqual()

bool almostEqual ( const M2::ARingCCC & C,
int nbits,
const M2::ARingCCC::ElementType & a,
const M2::ARingCCC::ElementType & b )

Definition at line 45 of file ARingCCCTest.cpp.

49{
50 mpfr_t epsilon;
51 mpfr_init2(epsilon, C.get_precision());
52 mpfr_set_ui_2exp(epsilon, 1, -nbits, MPFR_RNDN); // should there be exp() ???
53
55 C.init(c);
56 C.subtract(c, a, b);
57
58 bool ret = mpfr_cmpabs(&c.re, epsilon) < 0 && mpfr_cmpabs(&c.im, epsilon) < 0;
59
60 C.clear(c);
61 mpfr_clear(epsilon);
62 return ret;
63}
void subtract(ElementType &result, const ElementType &a, const ElementType &b) const
void init(ElementType &result) const
unsigned long get_precision() const
Definition aring-CCC.hpp:88
static void clear(ElementType &result)
__mpfr_struct im
Definition ringelem.hpp:58
__mpfr_struct re
Definition ringelem.hpp:57

References M2::ARingCCC::clear(), M2::ARingCCC::get_precision(), cc_struct::im, M2::ARingCCC::init(), cc_struct::re, and M2::ARingCCC::subtract().

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