APRONXX
0.9.7
|
Scalar (ap_scalar_t wrapper). More...
#include <apxx_scalar.hh>
Inherits apron::use_malloc.
Public Types | |
enum | order { LESS = -1, EQUAL = 0, GREATER = 1 } |
Returned by ordering functions. More... | |
Public Member Functions | |
Constructors | |
scalar () | |
Makes a double scalar equal to 0.0. More... | |
scalar (int x) | |
Makes a MPQ scalar from a native integer. More... | |
scalar (long x) | |
Makes a MPQ scalar from a native integer. More... | |
scalar (double x) | |
Makes a double scalar from a double. More... | |
scalar (const frac &x) | |
Makes a MPQ scalar from a fraction with native integer coefficients. More... | |
scalar (infty x) | |
Makes a double scalar equal to +oo or -oo. More... | |
scalar (const mpq_class &x) | |
Makes a MPQ scalar from a MPQ (copied). More... | |
scalar (mpfr_t x) | |
Makes a MPFR scalar from a MPFR number (copied). More... | |
scalar (const scalar &x) | |
Makes a copy of a scalar. More... | |
Destructor | |
~scalar () | |
Accesses | |
ap_scalar_discr_t | get_discr () const |
Whether the object wraps a double or a MPQ. More... | |
double & | get_double () |
Returns a (modifiable) reference to the double contained in the scalar. More... | |
const double & | get_double () const |
Returns a reference to the double contained in the scalar. More... | |
mpq_class & | get_mpq () |
Returns a (modifiable) reference to the MPQ contained in the scalar. More... | |
const mpq_class & | get_mpq () const |
Return a reference to the MPQ contained in the scalar. More... | |
Conversions | |
mpq_class | to_mpq (mp_rnd_t round, order &conv) const |
Returns a new MPQ containing the (possibly converted) value of the scalar. More... | |
double | to_double (mp_rnd_t round, order &conv) const |
Returns a double containing the (possibly converted) value of the scalar. More... | |
void | to_mpfr (mpfr_t x, mp_rnd_t round, order &conv) const |
Copies the (possibly converted) value of the scalar into the MPFR. More... | |
operator mpq_class () const | |
Returns a new MPQ containing the (possibly converted) value of the scalar. No rounding. More... | |
operator double () const | |
Returns a double containing the (possibly converted) value of the scalar. Rounding to nearest. More... | |
Operators | |
void | neg () |
Negates *this. More... | |
scalar | operator- () const |
Returns the opposite of *this. More... | |
void | inv () |
Inverses *this. Not exact for double type. More... | |
scalar | operator~ () const |
Returns the inverse of *this. Not exact for double type. More... | |
long | hash () const |
Returns a hash code. More... | |
C API compatibility | |
const ap_scalar_t * | get_ap_scalar_t () const |
Returns a pointer to the internal APRON object stored in *this. More... | |
ap_scalar_t * | get_ap_scalar_t () |
Returns a pointer to the internal APRON object stored in *this. More... | |
![]() | |
void * | operator new (size_t sz) |
void * | operator new[] (size_t sz) |
void | operator delete (void *p) |
void | operator delete[] (void *p) |
Protected Attributes | |
ap_scalar_t | c |
Structure managed by APRON. More... | |
Assignments | |
scalar & | operator= (int x) |
Assigns a native integer to *this, setting its type to MPQ. More... | |
scalar & | operator= (long x) |
Assigns a native integer to *this, setting its type to MPQ. More... | |
scalar & | operator= (double x) |
Assigns a double to *this, setting its type to double. More... | |
scalar & | operator= (const frac &x) |
Assigns a fraction to *this, setting its type to MPQ. More... | |
scalar & | operator= (infty x) |
Assigns +oo or -oo to *this, no change in scalar type. More... | |
scalar & | operator= (const mpq_class &x) |
Assigns a MPQ to *this (copied), setting its type to MPQ. More... | |
scalar & | operator= (mpfr_t x) |
Assigns a MPFR to *this (copied), setting its type to MPFR. More... | |
scalar & | operator= (const scalar &x) |
Sets the type and value of *this to that of x. More... | |
void | swap (scalar &a, scalar &b) |
Swaps the contents (type and value) of two scalars. More... | |
Printing | |
void | print (FILE *stream=stdout) const |
Prints to a C stream. More... | |
std::ostream & | operator<< (std::ostream &os, const scalar &s) |
Printing. More... | |
Tests | |
order | is_infty () const |
Returns LESS if -oo, GREATER if +oo, EQUAL if finite. More... | |
order | sgn () const |
Returns LESS if negative, GREATER if positive, EQUAL if null. More... | |
order | cmp (const scalar &a, const scalar &b) |
Returns LESS if a<b, GREATER if a>b, EQUAL if a=b (total order). More... | |
bool | operator>= (const scalar &a, const scalar &b) |
bool | operator<= (const scalar &a, const scalar &b) |
bool | operator> (const scalar &a, const scalar &b) |
bool | operator< (const scalar &a, const scalar &b) |
bool | operator== (const scalar &a, const scalar &b) |
bool | operator!= (const scalar &a, const scalar &b) |
order | cmp (const scalar &a, int b) |
bool | operator>= (const scalar &a, int b) |
bool | operator<= (const scalar &a, int b) |
bool | operator> (const scalar &a, int b) |
bool | operator< (const scalar &a, int b) |
bool | operator== (const scalar &a, int b) |
bool | operator!= (const scalar &a, int b) |
order | cmp (int a, const scalar &b) |
bool | operator>= (int a, const scalar &b) |
bool | operator<= (int a, const scalar &b) |
bool | operator> (int a, const scalar &b) |
bool | operator< (int a, const scalar &b) |
bool | operator== (int a, const scalar &b) |
bool | operator!= (int a, const scalar &b) |
Scalar (ap_scalar_t wrapper).
A scalar object represents a (possibly +oo or -oo) number, using either a double or a MPQ (multi-precision fraction). All operations are exact unless explicitly noted.
enum apron::scalar::order |
|
inline |
Makes a double scalar equal to 0.0.
|
inline |
Makes a MPQ scalar from a native integer.
|
inline |
Makes a MPQ scalar from a native integer.
|
inline |
Makes a double scalar from a double.
|
inline |
Makes a MPQ scalar from a fraction with native integer coefficients.
|
inline |
Makes a double scalar equal to +oo or -oo.
|
inline |
Makes a MPQ scalar from a MPQ (copied).
|
inline |
Makes a MPFR scalar from a MPFR number (copied).
|
inline |
Makes a copy of a scalar.
|
inline |
|
inline |
Returns a pointer to the internal APRON object stored in *this.
|
inline |
Returns a pointer to the internal APRON object stored in *this.
|
inline |
Whether the object wraps a double or a MPQ.
AP_SCALAR_DOUBLE
, AP_SCALAR_MPQ
, or AP_SCALAR_MPFR
.
|
inline |
Returns a (modifiable) reference to the double contained in the scalar.
bad_discriminant | when the scalar is not of double type. |
|
inline |
Returns a reference to the double contained in the scalar.
bad_discriminant | when the scalar is not of double type. |
|
inline |
Returns a (modifiable) reference to the MPQ contained in the scalar.
bad_discriminant | when the scalar is not of MPQ type. |
|
inline |
Return a reference to the MPQ contained in the scalar.
bad_discriminant | when the scalar is not of MPQ type. |
|
inline |
Returns a hash code.
|
inline |
Inverses *this. Not exact for double type.
|
inline |
Returns LESS if -oo, GREATER if +oo, EQUAL if finite.
|
inline |
Negates *this.
|
inline |
Returns a double containing the (possibly converted) value of the scalar. Rounding to nearest.
|
inline |
Returns a new MPQ containing the (possibly converted) value of the scalar. No rounding.
|
inline |
Returns the opposite of *this.
|
inline |
Assigns a native integer to *this, setting its type to MPQ.
|
inline |
Assigns a native integer to *this, setting its type to MPQ.
|
inline |
Assigns a double to *this, setting its type to double.
Assigns a fraction to *this, setting its type to MPQ.
|
inline |
Assigns a MPQ to *this (copied), setting its type to MPQ.
|
inline |
Assigns a MPFR to *this (copied), setting its type to MPFR.
Sets the type and value of *this to that of x.
|
inline |
Returns the inverse of *this. Not exact for double type.
|
inline |
Prints to a C stream.
|
inline |
Returns LESS if negative, GREATER if positive, EQUAL if null.
|
inline |
Returns a double containing the (possibly converted) value of the scalar.
round:
rounding direction, may be GMP_RNDN, GMP_RNDZ, GMP_RNDU, GMP_RNDD, or GMP_RND_MAX. conv
is set to either LESS, EQUAL, or GREATER, depending on whether the result is less than, equal to or greater than the value of *this.
|
inline |
Copies the (possibly converted) value of the scalar into the MPFR.
round:
rounding direction, may be GMP_RNDN, GMP_RNDZ, GMP_RNDU, GMP_RNDD, or GMP_RND_MAX. conv
is set to either LESS, EQUAL, or GREATER, depending on whether the result is less than, equal to or greater than the value of *this.
|
inline |
Returns a new MPQ containing the (possibly converted) value of the scalar.
round:
rounding direction, may be GMP_RNDN, GMP_RNDZ, GMP_RNDU, GMP_RNDD, or GMP_RND_MAX. conv
is set to either LESS, EQUAL, or GREATER, depending on whether the result is less than, equal to or greater than the value of *this. Returns LESS if a<b, GREATER if a>b, EQUAL if a=b (total order).
|
friend |
|
friend |
|
friend |
Printing.
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
friend |
|
protected |
Structure managed by APRON.