boost::real::real_explicit is a C++ class that fully represents real numbers as a vector of digits, a sign and an exponent.
More...
#include <real_explicit.hpp>
|
class | const_precision_iterator |
| is a forward iterator that iterates a boost::real::real_explicit number approximation intervals. The iterator calculates the initial interval with the initial precision and then it increase the precision in each iteration (++) and recalculate the interval. More...
|
|
boost::real::real_explicit is a C++ class that fully represents real numbers as a vector of digits, a sign and an exponent.
- Author
- Laouen Mayal Louan Belloli
boost::real::real_explicit::real_explicit |
( |
const real_explicit & |
other | ) |
|
|
default |
boost::real::real_explicit::real_explicit |
( |
const std::string & |
number | ) |
|
|
inlineexplicit |
String constructor: Creates a boost::real::real_explicit instance by parsing the string. The string must have a valid number, in other case, the constructor will throw an boost::real::invalid_string_number exception.
- Parameters
-
number | - a valid string representing a number. |
- Exceptions
-
boost::real::invalid_string_number | exception |
boost::real::real_explicit::real_explicit |
( |
std::initializer_list< int > |
digits, |
|
|
int |
exponent |
|
) |
| |
|
inline |
Initializer list constructor with exponent: Creates a boost::real::real_explicit instance that represents the number where the exponent is used to set the number integer part and the elements of the digits list are the digits the number in the same order. The number is set as positive.
- Parameters
-
digits | - an initializer_list<int> that represent the number digits. |
exponent | - an integer representing the number exponent. |
boost::real::real_explicit::real_explicit |
( |
std::initializer_list< int > |
digits, |
|
|
int |
exponent, |
|
|
bool |
positive |
|
) |
| |
|
inline |
Initializer list constructor with exponent and sign: Creates a boost::real::real_explicit instance that represents the number where the exponent is used to set the number integer part and the elements of the digit list are the digits the number in the same order. This constructor uses the sign to determine if the number is positive or negative.
- Parameters
-
digits | - an initializer_list<int> that represent the number digits. |
exponent | - an integer representing the number exponent. |
positive | - a bool that represent the number sign. If positive is set to true, the number is positive, otherwise is negative. |
const std::vector<int>& boost::real::real_explicit::digits |
( |
| ) |
const |
|
inline |
- Returns
- a const reference to the vector holding the number digits
int boost::real::real_explicit::exponent |
( |
| ) |
const |
|
inline |
- Returns
- An integer with the number exponent
unsigned int boost::real::real_explicit::max_precision |
( |
| ) |
const |
|
inline |
Returns te maximum allowed precision, if that precision is reached and an operator need more precision, a precision_exception should be thrown.
- Returns
- and integer with the maximum allowed precision.
int boost::real::real_explicit::operator[] |
( |
unsigned int |
n | ) |
const |
|
inline |
Returns the n-th digit the number.
- Parameters
-
n | - an unsigned int number indicating the index of the requested digit. |
- Returns
- an integer with the value of the number n-th digit.
bool boost::real::real_explicit::positive |
( |
| ) |
const |
|
inline |
- Returns
- A bool indicating if the number is positive (true) or negative (false)
void boost::real::real_explicit::set_maximum_precision |
( |
unsigned int |
maximum_precision | ) |
|
|
inline |
Set a new maximum precision for the instance.
- Parameters
-
maximum_precision | - an unsigned int to set as the new precision. |
The documentation for this class was generated from the following file: