29 flint_mpq_init_set_readonly(temp, &f);
31 flint_mpq_clear_readonly(temp);
49 bool is_neg = (fmpq_sgn(&a) == -1);
52 size_t size = fmpz_sizeinbase(fmpq_numref(&a), 10) +
53 fmpz_sizeinbase(fmpq_denref(&a), 10) + 3;
58 if (!is_neg && p_plus) o <<
'+';
66 str = fmpq_get_str(allocstr, 10, &a);
70 if (size > 1000)
freemem(allocstr);
M2::ARingQQFlint — rationals backed by FLINT's fmpq with small-value inlining.
#define FLINT_RAND_INIT(x)
#define FLINT_RAND_CLEAR(x)
flint_rand_t mRandomState
void divide(ElementType &result, const ElementType &a, const ElementType &b) const
test doc
void eval(const RingMap *map, const ElementType &f, int first_var, ring_elem &result) const
void elem_text_out(buffer &o, const ElementType &a, bool p_one=true, bool p_plus=false, bool p_parens=false) const
void negate(ElementType &result, const ElementType &a) const
bool is_pm_one(const ElementType &f) const
void set_from_long(ElementType &result, long a) const
void syzygy(const ElementType &a, const ElementType &b, ElementType &x, ElementType &y) const
bool is_zero(const ElementType &f) const
virtual bool from_rational(const mpq_srcptr q, ring_elem &result) const =0
const Ring * get_ring() const
Engine-side ring homomorphism: stores, for each source-ring variable, the target-ring element it maps...
VALGRIND_MAKE_MEM_DEFINED & result(result)
#define newarray_atomic(T, len)
RingMap — engine representation of a ring homomorphism.