39#include <gtest/gtest.h>
52 mpfr_set_ui_2exp(epsilon, 1, -nbits, MPFR_RNDN);
57 bool ret = mpfr_cmpabs(&c, epsilon) < 0;
96 for (
int i = 0; i <
ntrials; i++)
125 for (
int i = 0; i <
ntrials; i++)
151 for (
int i = 0; i <
ntrials; i++)
178 for (
int i = 0; i <
ntrials; i++)
208 for (
int i = 0; i <
ntrials; i++)
253TEST(ARingRRR, power_and_invert)
264 for (
int i = 0; i <
ntrials; i++)
276 R.
power(d, a, e1 + e2);
281 mpz_set_si(gmp1, e1);
void getElement< M2::ARingRRR >(const M2::ARingRRR &R, int index, M2::ARingRRR::ElementType &result)
void testRingNegateRRR(const M2::ARingRRR &R, int ntrials)
bool almostEqual(const M2::ARingRRR &R, int nbits, const M2::ARingRRR::ElementType &a, const M2::ARingRRR::ElementType &b)
std::string ringName(const T &R)
Shared gtest harness for the ARing*Test.cpp suite.
M2::ARingRRR — arbitrary-precision real numbers backed by MPFR.
void nextElement(typename RingType::ElementType &result)
size_t characteristic() const
void power_mpz(ElementType &result, const ElementType &a, mpz_srcptr n) const
void random(ElementType &result) const
void negate(ElementType &result, const ElementType &a) const
bool is_equal(const ElementType &f, const ElementType &g) const
void subtract_multiple(ElementType &result, const ElementType &a, const ElementType &b) const
bool is_zero(const ElementType &f) const
void set_from_long(ElementType &result, long a) const
void divide(ElementType &result, const ElementType &a, const ElementType &b) const
void subtract(ElementType &result, const ElementType &a, const ElementType &b) const
void mult(ElementType &result, const ElementType &a, const ElementType &b) const
static void clear(ElementType &result)
void power(ElementType &result, const ElementType &a, int n) const
void init(ElementType &result) const
void add(ElementType &result, const ElementType &a, const ElementType &b) const
unsigned long get_precision() const
aring-style adapter for arbitrary-precision real numbers, backed by MPFR.
void subtract(int &result, int a, int b)
VALGRIND_MAKE_MEM_DEFINED & result(result)
int32_t rawRandomInt(int32_t max)