38#include <gtest/gtest.h>
52 mpfr_set_ui_2exp(epsilon, 1, -nbits, MPFR_RNDN);
58 bool ret = mpfr_cmpabs(&c.
re, epsilon) < 0 && mpfr_cmpabs(&c.
im, epsilon) < 0;
90 for (
int i = 0; i <
ntrials; i++)
119 for (
int i = 0; i <
ntrials; i++)
145 for (
int i = 0; i <
ntrials; i++)
172 for (
int i = 0; i <
ntrials; i++)
202 for (
int i = 0; i <
ntrials; i++)
248TEST(ARingCCC, power_and_invert)
259 for (
int i = 0; i <
ntrials; i++)
271 C.
power(d, a, e1 + e2);
278 mpz_set_si(gmp1, e1);
bool almostEqual(const M2::ARingCCC &C, int nbits, const M2::ARingCCC::ElementType &a, const M2::ARingCCC::ElementType &b)
void getElement< M2::ARingCCC >(const M2::ARingCCC &C, int index, M2::ARingCCC::ElementType &result)
void testRingNegateCCC(const M2::ARingCCC &C, int ntrials)
std::string ringName(const T &R)
Shared gtest harness for the ARing*Test.cpp suite.
M2::ARingCCC — arbitrary-precision complex numbers (pair of MPFR floats).
M2::ARingRRR — arbitrary-precision real numbers backed by MPFR.
void nextElement(typename RingType::ElementType &result)
void set_from_long(ElementType &result, long a) const
bool is_zero(const ElementType &f) const
void add(ElementType &result, const ElementType &a, const ElementType &b) const
size_t characteristic() const
void subtract(ElementType &result, const ElementType &a, const ElementType &b) const
void random(ElementType &result) const
void init(ElementType &result) const
void negate(ElementType &result, const ElementType &a) const
bool is_equal(const ElementType &f, const ElementType &g) const
unsigned long get_precision() const
void mult(ElementType &res, const ElementType &a, const RealElementType &b) const
void power_mpz(ElementType &result, const ElementType &a, mpz_srcptr n) const
void subtract_multiple(ElementType &result, const ElementType &a, const ElementType &b) const
void power(ElementType &result, const ElementType &a, int n) const
static void clear(ElementType &result)
void divide(ElementType &res, const ElementType &a, const RealElementType &b) const
aring-style adapter for arbitrary-precision complex numbers, stored as (MPFR, MPFR) pairs.
void subtract(int &result, int a, int b)
VALGRIND_MAKE_MEM_DEFINED & result(result)
int32_t rawRandomInt(int32_t max)