36#include <gtest/gtest.h>
54 mpfr_set_ui_2exp(epsilon, 1, -nbits, MPFR_RNDN);
60 mpfr_sub(c,&(a.left),&(b.left),MPFR_RNDN);
61 mpfr_sub(d,&(a.right),&(b.right),MPFR_RNDN);
63 bool retL = mpfr_cmpabs(c, epsilon) < 0,
64 retR = mpfr_cmpabs(d, epsilon) < 0;
100 for (
int i = 0; i <
ntrials; i++)
132 for (
int i = 0; i <
ntrials; i++)
162 for (
int i = 0; i <
ntrials; i++)
191 for (
int i = 0; i <
ntrials; i++)
223 for (
int i = 0; i <
ntrials; i++)
271TEST(ARingRRi, power_and_invert)
283 for (
int i = 0; i <
ntrials; i++)
295 R.
power(d, a, e1 + e2);
300 mpz_set_si(gmp1, e1);
void getElement< M2::ARingRRi >(const M2::ARingRRi &R, int index, M2::ARingRRi::ElementType &result)
bool almostEqual(const M2::ARingRRi &R, int nbits, const M2::ARingRRi::ElementType &a, const M2::ARingRRi::ElementType &b)
void testRingNegateRRi(const M2::ARingRRi &R, const M2::ARingRRR &S, int ntrials)
std::string ringName(const T &R)
Shared gtest harness for the ARing*Test.cpp suite.
M2::ARingRRR — arbitrary-precision real numbers backed by MPFR.
M2::ARingRRi — certified real intervals [a, b] with MPFR endpoints, MPFI arithmetic.
ConcreteRing<RingType> — the templated bridge between aring and the legacy Ring API.
void nextElement(typename RingType::ElementType &result)
bool is_zero(const ElementType &f) const
static void clear(ElementType &result)
void init(ElementType &result) const
aring-style adapter for arbitrary-precision real numbers, backed by MPFR.
void divide(ElementType &result, const ElementType &a, const ElementType &b) const
static void clear(ElementType &result)
void subtract(ElementType &result, const ElementType &a, const ElementType &b) const
size_t characteristic() const
void midpoint(ARingRRR::ElementType &a, const ElementType &b) const
void init(ElementType &result) const
void random(ElementType &result) const
void negate(ElementType &result, const ElementType &a) const
void subtract_multiple(ElementType &result, const ElementType &a, const ElementType &b) const
bool is_subset(const ElementType &g, const ElementType &f) const
bool is_member(const ARingRRR::ElementType &a, const ElementType &f) const
void set_from_long(ElementType &result, long a) const
void add(ElementType &result, const ElementType &a, const ElementType &b) const
bool is_equal(const ElementType &f, const ElementType &g) const
void power(ElementType &result, const ElementType &a, int n) const
unsigned long get_precision() const
void mult(ElementType &result, const ElementType &a, const ElementType &b) const
void power_mpz(ElementType &result, const ElementType &a, mpz_srcptr n) const
aring-style adapter for arbitrary-precision real intervals, backed by MPFI.
void subtract(int &result, int a, int b)
VALGRIND_MAKE_MEM_DEFINED & result(result)
int32_t rawRandomInt(int32_t max)