16 #ifndef __APXX_SCALAR_HH 17 #define __APXX_SCALAR_HH 22 #include "ap_scalar.h" 70 void*
operator new (
size_t sz);
71 void*
operator new[] (
size_t sz);
72 void operator delete (
void* p);
73 void operator delete[](
void* p);
129 scalar(
const mpq_class& x);
221 const mpq_class&
get_mpq()
const;
239 mpq_class
to_mpq(mp_rnd_t round,
order& conv)
const;
255 void to_mpfr(mpfr_t x, mp_rnd_t round,
order& conv)
const;
258 operator mpq_class()
const;
261 operator double()
const;
276 void print(FILE* stream=stdout)
const;
void neg()
Negates *this.
Definition: apxx_scalar.hh:417
double & get_double()
Returns a (modifiable) reference to the double contained in the scalar.
Definition: apxx_scalar.hh:190
void inv()
Inverses *this. Not exact for double type.
Definition: apxx_scalar.hh:429
mpq_class to_mpq(mp_rnd_t round, order &conv) const
Returns a new MPQ containing the (possibly converted) value of the scalar.
Definition: apxx_scalar.hh:218
const ap_scalar_t * get_ap_scalar_t() const
Returns a pointer to the internal APRON object stored in *this.
Definition: apxx_scalar.hh:450
Definition: apxx_abstract0.hh:27
friend bool operator==(const scalar &a, const scalar &b)
Definition: apxx_scalar.hh:332
unsigned long den
Denominator.
Definition: apxx_scalar.hh:44
ap_scalar_t c
Structure managed by APRON.
Definition: apxx_scalar.hh:92
Means less than, negative, or -oo (depending on context).
Definition: apxx_scalar.hh:98
Exception raised when an operation is incompatible with a discriminant.
Definition: apxx_scalar.hh:55
void to_mpfr(mpfr_t x, mp_rnd_t round, order &conv) const
Copies the (possibly converted) value of the scalar into the MPFR.
Definition: apxx_scalar.hh:234
friend bool operator!=(const scalar &a, const scalar &b)
Definition: apxx_scalar.hh:337
long hash() const
Returns a hash code.
Definition: apxx_scalar.hh:441
Means greater than, positive, or +oo (depending on context).
Definition: apxx_scalar.hh:100
ap_scalar_discr_t get_discr() const
Whether the object wraps a double or a MPQ.
Definition: apxx_scalar.hh:185
friend bool operator>(const scalar &a, const scalar &b)
Definition: apxx_scalar.hh:322
Either +oo or -oo, to simplify initialisations and assignments.
Definition: apxx_scalar.hh:30
friend void swap(scalar &a, scalar &b)
Swaps the contents (type and value) of two scalars.
Definition: apxx_scalar.hh:176
~scalar()
Definition: apxx_scalar.hh:114
friend bool operator>=(const scalar &a, const scalar &b)
Definition: apxx_scalar.hh:312
frac(long num, unsigned long den=1)
Definition: apxx_scalar.hh:49
Means equal or null (depending on context).
Definition: apxx_scalar.hh:99
friend bool operator<=(const scalar &a, const scalar &b)
Definition: apxx_scalar.hh:317
order
Returned by ordering functions.
Definition: apxx_scalar.hh:97
scalar()
Makes a double scalar equal to 0.0.
Definition: apxx_scalar.hh:57
bad_discriminant(const std::string &arg)
Definition: apxx_scalar.hh:59
Inherited by most wrappers to map new and delete to malloc and free.
Definition: apxx_scalar.hh:69
friend order cmp(const scalar &a, const scalar &b)
Returns LESS if a<b, GREATER if a>b, EQUAL if a=b (total order).
Definition: apxx_scalar.hh:307
mpq_class & get_mpq()
Returns a (modifiable) reference to the MPQ contained in the scalar.
Definition: apxx_scalar.hh:202
infty(int sgn=1)
Definition: apxx_scalar.hh:35
A fraction with native int coefficients, to simplify initialisations and assignments.
Definition: apxx_scalar.hh:41
scalar operator~() const
Returns the inverse of *this. Not exact for double type.
Definition: apxx_scalar.hh:434
order sgn() const
Returns LESS if negative, GREATER if positive, EQUAL if null.
Definition: apxx_scalar.hh:301
long num
Numerator.
Definition: apxx_scalar.hh:43
double to_double(mp_rnd_t round, order &conv) const
Returns a double containing the (possibly converted) value of the scalar.
Definition: apxx_scalar.hh:226
void print(FILE *stream=stdout) const
Prints to a C stream.
Definition: apxx_scalar.hh:287
int sgn
Sign: >0 for +oo, <0 for -oo.
Definition: apxx_scalar.hh:32
order is_infty() const
Returns LESS if -oo, GREATER if +oo, EQUAL if finite.
Definition: apxx_scalar.hh:296
scalar & operator=(int x)
Assigns a native integer to *this, setting its type to MPQ.
Definition: apxx_scalar.hh:125
friend bool operator<(const scalar &a, const scalar &b)
Definition: apxx_scalar.hh:327
friend std::ostream & operator<<(std::ostream &os, const scalar &s)
Printing.
Definition: apxx_scalar.hh:256
scalar operator-() const
Returns the opposite of *this.
Definition: apxx_scalar.hh:422
Scalar (ap_scalar_t wrapper).
Definition: apxx_scalar.hh:89