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

◆ almostEqual()

bool almostEqual ( const M2::ARingCC & C,
unsigned long nbits,
const M2::ARingCC::ElementType & a,
const M2::ARingCC::ElementType & b )

Definition at line 45 of file ARingCCTest.cpp.

49{
50 M2::ARingRR::ElementType epsilon = pow(2, static_cast<double>(-nbits));
53 C.subtract(c, a, b);
54 C.abs(d, c);
55 return C.real_ring().compare_elems(d, epsilon) < 0;
56}
elem ElementType
Definition aring-CC.hpp:81
void abs(ARingRR::ElementType &result, const ElementType &a) const
Definition aring-CC.hpp:356
const RealRingType & real_ring() const
Definition aring-CC.hpp:91
void subtract(ElementType &res, const ElementType &a, const ElementType &b) const
Definition aring-CC.hpp:283
int compare_elems(const ElementType &f, const ElementType &g) const
Definition aring-RR.hpp:92
elem ElementType
Definition aring-RR.hpp:68
const mpreal pow(const mpreal &a, const unsigned int b, mp_rnd_t rnd_mode=mpreal::get_default_rnd())
Definition mpreal.h:2962

References M2::ARingCC::abs(), M2::ARingRR::compare_elems(), M2::ARingCC::real_ring(), and M2::ARingCC::subtract().

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