Scalar (ap_scalar_t wrapper).
More...
#include <apxx_scalar.hh>
Inherits apron::use_malloc.
|
ap_scalar_t | c |
| Structure managed by APRON. More...
|
|
|
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.
◆ order
Returned by ordering functions.
Enumerator |
---|
LESS | Means less than, negative, or -oo (depending on context).
|
EQUAL | Means equal or null (depending on context).
|
GREATER | Means greater than, positive, or +oo (depending on context).
|
◆ scalar() [1/9]
Makes a double scalar equal to 0.0.
◆ scalar() [2/9]
Makes a MPQ scalar from a native integer.
◆ scalar() [3/9]
Makes a MPQ scalar from a native integer.
◆ scalar() [4/9]
scalar::scalar |
( |
double |
x | ) |
|
|
inline |
Makes a double scalar from a double.
◆ scalar() [5/9]
scalar::scalar |
( |
const frac & |
x | ) |
|
|
inline |
Makes a MPQ scalar from a fraction with native integer coefficients.
◆ scalar() [6/9]
scalar::scalar |
( |
infty |
x | ) |
|
|
inline |
Makes a double scalar equal to +oo or -oo.
◆ scalar() [7/9]
scalar::scalar |
( |
const mpq_class & |
x | ) |
|
|
inline |
Makes a MPQ scalar from a MPQ (copied).
◆ scalar() [8/9]
scalar::scalar |
( |
mpfr_t |
x | ) |
|
|
inline |
Makes a MPFR scalar from a MPFR number (copied).
◆ scalar() [9/9]
scalar::scalar |
( |
const scalar & |
x | ) |
|
|
inline |
Makes a copy of a scalar.
◆ ~scalar()
◆ get_ap_scalar_t() [1/2]
const ap_scalar_t * scalar::get_ap_scalar_t |
( |
| ) |
const |
|
inline |
Returns a pointer to the internal APRON object stored in *this.
◆ get_ap_scalar_t() [2/2]
ap_scalar_t * scalar::get_ap_scalar_t |
( |
| ) |
|
|
inline |
Returns a pointer to the internal APRON object stored in *this.
◆ get_discr()
ap_scalar_discr_t scalar::get_discr |
( |
| ) |
const |
|
inline |
Whether the object wraps a double or a MPQ.
- Returns
- Either
AP_SCALAR_DOUBLE
, AP_SCALAR_MPQ
, or AP_SCALAR_MPFR
.
◆ get_double() [1/2]
double & scalar::get_double |
( |
| ) |
|
|
inline |
Returns a (modifiable) reference to the double contained in the scalar.
- Exceptions
-
◆ get_double() [2/2]
const double & scalar::get_double |
( |
| ) |
const |
|
inline |
Returns a reference to the double contained in the scalar.
- Exceptions
-
◆ get_mpq() [1/2]
mpq_class & scalar::get_mpq |
( |
| ) |
|
|
inline |
Returns a (modifiable) reference to the MPQ contained in the scalar.
- Exceptions
-
◆ get_mpq() [2/2]
const mpq_class & scalar::get_mpq |
( |
| ) |
const |
|
inline |
Return a reference to the MPQ contained in the scalar.
- Exceptions
-
◆ hash()
long scalar::hash |
( |
| ) |
const |
|
inline |
◆ inv()
Inverses *this. Not exact for double type.
◆ is_infty()
Returns LESS if -oo, GREATER if +oo, EQUAL if finite.
◆ neg()
◆ operator double()
scalar::operator double |
( |
| ) |
const |
|
inline |
Returns a double containing the (possibly converted) value of the scalar. Rounding to nearest.
◆ operator mpq_class()
scalar::operator mpq_class |
( |
| ) |
const |
|
inline |
Returns a new MPQ containing the (possibly converted) value of the scalar. No rounding.
◆ operator-()
scalar scalar::operator- |
( |
| ) |
const |
|
inline |
Returns the opposite of *this.
◆ operator=() [1/8]
scalar & scalar::operator= |
( |
int |
x | ) |
|
|
inline |
Assigns a native integer to *this, setting its type to MPQ.
◆ operator=() [2/8]
scalar & scalar::operator= |
( |
long |
x | ) |
|
|
inline |
Assigns a native integer to *this, setting its type to MPQ.
◆ operator=() [3/8]
scalar & scalar::operator= |
( |
double |
x | ) |
|
|
inline |
Assigns a double to *this, setting its type to double.
◆ operator=() [4/8]
Assigns a fraction to *this, setting its type to MPQ.
◆ operator=() [5/8]
Assigns +oo or -oo to *this, no change in scalar type.
◆ operator=() [6/8]
scalar & scalar::operator= |
( |
const mpq_class & |
x | ) |
|
|
inline |
Assigns a MPQ to *this (copied), setting its type to MPQ.
◆ operator=() [7/8]
scalar & scalar::operator= |
( |
mpfr_t |
x | ) |
|
|
inline |
Assigns a MPFR to *this (copied), setting its type to MPFR.
◆ operator=() [8/8]
Sets the type and value of *this to that of x.
◆ operator~()
scalar scalar::operator~ |
( |
| ) |
const |
|
inline |
Returns the inverse of *this. Not exact for double type.
◆ print()
void scalar::print |
( |
FILE * |
stream = stdout | ) |
const |
|
inline |
◆ sgn()
Returns LESS if negative, GREATER if positive, EQUAL if null.
◆ to_double()
double scalar::to_double |
( |
mp_rnd_t |
round, |
|
|
order & |
conv |
|
) |
| const |
|
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.
◆ to_mpfr()
void scalar::to_mpfr |
( |
mpfr_t |
x, |
|
|
mp_rnd_t |
round, |
|
|
order & |
conv |
|
) |
| const |
|
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.
◆ to_mpq()
mpq_class scalar::to_mpq |
( |
mp_rnd_t |
round, |
|
|
order & |
conv |
|
) |
| const |
|
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. - Note
- Currently round is ignored and the conversion is always exact.
◆ cmp [1/3]
Returns LESS if a<b, GREATER if a>b, EQUAL if a=b (total order).
◆ cmp [2/3]
◆ cmp [3/3]
◆ operator!= [1/3]
◆ operator!= [2/3]
◆ operator!= [3/3]
◆ operator< [1/3]
◆ operator< [2/3]
bool operator< |
( |
const scalar & |
a, |
|
|
int |
b |
|
) |
| |
|
friend |
◆ operator< [3/3]
bool operator< |
( |
int |
a, |
|
|
const scalar & |
b |
|
) |
| |
|
friend |
◆ operator<<
std::ostream& operator<< |
( |
std::ostream & |
os, |
|
|
const scalar & |
s |
|
) |
| |
|
friend |
◆ operator<= [1/3]
◆ operator<= [2/3]
bool operator<= |
( |
const scalar & |
a, |
|
|
int |
b |
|
) |
| |
|
friend |
◆ operator<= [3/3]
bool operator<= |
( |
int |
a, |
|
|
const scalar & |
b |
|
) |
| |
|
friend |
◆ operator== [1/3]
◆ operator== [2/3]
bool operator== |
( |
const scalar & |
a, |
|
|
int |
b |
|
) |
| |
|
friend |
◆ operator== [3/3]
bool operator== |
( |
int |
a, |
|
|
const scalar & |
b |
|
) |
| |
|
friend |
◆ operator> [1/3]
◆ operator> [2/3]
bool operator> |
( |
const scalar & |
a, |
|
|
int |
b |
|
) |
| |
|
friend |
◆ operator> [3/3]
bool operator> |
( |
int |
a, |
|
|
const scalar & |
b |
|
) |
| |
|
friend |
◆ operator>= [1/3]
◆ operator>= [2/3]
bool operator>= |
( |
const scalar & |
a, |
|
|
int |
b |
|
) |
| |
|
friend |
◆ operator>= [3/3]
bool operator>= |
( |
int |
a, |
|
|
const scalar & |
b |
|
) |
| |
|
friend |
◆ swap
Swaps the contents (type and value) of two scalars.
ap_scalar_t apron::scalar::c |
|
protected |
Structure managed by APRON.
The documentation for this class was generated from the following files: