Scalar (ap_scalar_t wrapper).  
 More...
#include <apxx_scalar.hh>
Inherits apron::use_malloc.
|  | 
|  | 
|  | scalar () | 
|  | Makes a double scalar equal to 0.0. 
 | 
|  | 
|  | scalar (int x) | 
|  | Makes a MPQ scalar from a native integer. 
 | 
|  | 
|  | scalar (long x) | 
|  | Makes a MPQ scalar from a native integer. 
 | 
|  | 
|  | scalar (double x) | 
|  | Makes a double scalar from a double. 
 | 
|  | 
|  | scalar (const frac &x) | 
|  | Makes a MPQ scalar from a fraction with native integer coefficients. 
 | 
|  | 
|  | scalar (infty x) | 
|  | Makes a double scalar equal to +oo or -oo. 
 | 
|  | 
|  | scalar (const mpq_class &x) | 
|  | Makes a MPQ scalar from a MPQ (copied). 
 | 
|  | 
|  | scalar (mpfr_t x) | 
|  | Makes a MPFR scalar from a MPFR number (copied). 
 | 
|  | 
|  | scalar (const scalar &x) | 
|  | Makes a copy of a scalar. 
 | 
|  | 
|  | 
|  | ~scalar () | 
|  | 
|  | 
| ap_scalar_discr_t | get_discr () const | 
|  | Whether the object wraps a double or a MPQ. 
 | 
|  | 
| double & | get_double () | 
|  | Returns a (modifiable) reference to the double contained in the scalar. 
 | 
|  | 
| const double & | get_double () const | 
|  | Returns a reference to the double contained in the scalar. 
 | 
|  | 
| mpq_class & | get_mpq () | 
|  | Returns a (modifiable) reference to the MPQ contained in the scalar. 
 | 
|  | 
| const mpq_class & | get_mpq () const | 
|  | Return a reference to the MPQ contained in the scalar. 
 | 
|  | 
|  | 
| mpq_class | to_mpq (mp_rnd_t round, order &conv) const | 
|  | Returns a new MPQ containing the (possibly converted) value of the scalar. 
 | 
|  | 
| double | to_double (mp_rnd_t round, order &conv) const | 
|  | Returns a double containing the (possibly converted) value of the scalar. 
 | 
|  | 
| void | to_mpfr (mpfr_t x, mp_rnd_t round, order &conv) const | 
|  | Copies the (possibly converted) value of the scalar into the MPFR. 
 | 
|  | 
|  | operator mpq_class () const | 
|  | Returns a new MPQ containing the (possibly converted) value of the scalar. No rounding. 
 | 
|  | 
|  | operator double () const | 
|  | Returns a double containing the (possibly converted) value of the scalar. Rounding to nearest. 
 | 
|  | 
|  | 
| void | neg () | 
|  | Negates *this. 
 | 
|  | 
| scalar | operator- () const | 
|  | Returns the opposite of *this. 
 | 
|  | 
| void | inv () | 
|  | Inverses *this. Not exact for double type. 
 | 
|  | 
| scalar | operator~ () const | 
|  | Returns the inverse of *this. Not exact for double type. 
 | 
|  | 
| long | hash () const | 
|  | Returns a hash code. 
 | 
|  | 
|  | 
| const ap_scalar_t * | get_ap_scalar_t () const | 
|  | Returns a pointer to the internal APRON object stored in *this. 
 | 
|  | 
| ap_scalar_t * | get_ap_scalar_t () | 
|  | Returns a pointer to the internal APRON object stored in *this. 
 | 
|  | 
| void * | operator new (size_t sz) | 
|  | 
| void * | operator new[] (size_t sz) | 
|  | 
| void | operator delete (void *p) | 
|  | 
| void | operator delete[] (void *p) | 
|  | 
|  | 
| ap_scalar_t | c | 
|  | Structure managed by APRON. 
 | 
|  | 
|  | 
| scalar & | operator= (int x) | 
|  | Assigns a native integer to *this, setting its type to MPQ. 
 | 
|  | 
| scalar & | operator= (long x) | 
|  | Assigns a native integer to *this, setting its type to MPQ. 
 | 
|  | 
| scalar & | operator= (double x) | 
|  | Assigns a double to *this, setting its type to double. 
 | 
|  | 
| scalar & | operator= (const frac &x) | 
|  | Assigns a fraction to *this, setting its type to MPQ. 
 | 
|  | 
| scalar & | operator= (infty x) | 
|  | Assigns +oo or -oo to *this, no change in scalar type. 
 | 
|  | 
| scalar & | operator= (const mpq_class &x) | 
|  | Assigns a MPQ to *this (copied), setting its type to MPQ. 
 | 
|  | 
| scalar & | operator= (mpfr_t x) | 
|  | Assigns a MPFR to *this (copied), setting its type to MPFR. 
 | 
|  | 
| scalar & | operator= (const scalar &x) | 
|  | Sets the type and value of *this to that of x. 
 | 
|  | 
|  | 
| void | print (FILE *stream=stdout) const | 
|  | Prints to a C stream. 
 | 
|  | 
|  | 
| order | is_infty () const | 
|  | Returns LESS if -oo, GREATER if +oo, EQUAL if finite. 
 | 
|  | 
| order | sgn () const | 
|  | Returns LESS if negative, GREATER if positive, EQUAL if null. 
 | 
|  | 
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]
  
  | 
        
          | ap_scalar_t * scalar::get_ap_scalar_t | ( |  | ) |  |  | inline | 
 
Returns a pointer to the internal APRON object stored in *this. 
 
 
◆ get_ap_scalar_t() [2/2]
  
  | 
        
          | const ap_scalar_t * scalar::get_ap_scalar_t | ( |  | ) | const |  | 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, orAP_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]
Assigns a fraction to *this, setting its type to MPQ. 
 
 
◆ operator=() [2/8]
  
  | 
        
          | scalar & scalar::operator= | ( | const mpq_class & | x | ) |  |  | inline | 
 
Assigns a MPQ to *this (copied), setting its type to MPQ. 
 
 
◆ operator=() [3/8]
Sets the type and value of *this to that of x. 
 
 
◆ operator=() [4/8]
  
  | 
        
          | scalar & scalar::operator= | ( | double | x | ) |  |  | inline | 
 
Assigns a double to *this, setting its type to double. 
 
 
◆ operator=() [5/8]
Assigns +oo or -oo to *this, no change in scalar type. 
 
 
◆ operator=() [6/8]
  
  | 
        
          | scalar & scalar::operator= | ( | int | x | ) |  |  | inline | 
 
Assigns a native integer to *this, setting its type to MPQ. 
 
 
◆ operator=() [7/8]
  
  | 
        
          | scalar & scalar::operator= | ( | long | x | ) |  |  | inline | 
 
Assigns a native integer to *this, setting its type to MPQ. 
 
 
◆ operator=() [8/8]
  
  | 
        
          | scalar & scalar::operator= | ( | mpfr_t | x | ) |  |  | inline | 
 
Assigns a MPFR to *this (copied), setting its type to MPFR. 
 
 
◆ 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.
- convis 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.
- convis 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.
- convis 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. 
 
 
 
  
  | 
        
          | ap_scalar_t apron::scalar::c |  | protected | 
 
Structure managed by APRON. 
 
 
The documentation for this class was generated from the following files: