Boost.Real  1.0.0
Boost.Real numerical data type for real numbers representation using range arithmetic.
boost::real::boundary Struct Reference

Explicitly represents a number as a vector of digits with a sign and an exponent. More...

#include <boundary.hpp>

Public Member Functions

 boundary ()=default
 default constructor: It construct a representation of the number zero.
 
 boundary (const boundary &other)=default
 Copy constructor: It construct a new boost::real::boundary that is a copy of the other boost::real::boundary. More...
 
boundaryoperator= (const boundary &other)=default
 Default asignment operator. More...
 
bool operator< (const boundary &other) const
 Lower comparator operator: It compares the *this boost::real::boundary with the other boost::real::boundary to determine if *this is lower than other. More...
 
bool operator> (const boundary &other) const
 Greater comparator operator: It compares the *this boost::real::boundary with the other boost::real::boundary to determine if *this is greater than other. More...
 
bool operator== (const boundary &other) const
 Equality comparator operator: It compares the *this boost::real::boundary with the other boost::real::boundary to determine if *this and other are equals or not. More...
 
std::basic_string< char > as_string () const
 Generates a string representation of the boost::real::boundary. More...
 
void swap (boundary &other)
 Swaps the boost::real::boundary value with the value of the other boost::real::boundary. This operation is a more preformant form of swapping to boost::real::boundaries. More...
 
void push_back (int digit)
 add the digit parameter as a new digit of the boost::real::boundary. The digit is added in the right side of the number. More...
 
void push_front (int digit)
 add the digit parameter as a new digit of the boost::real::boundary. The digit is added in the left side of the number. More...
 
void normalize ()
 Removes extra zeros at the sides to convert the number representation into a normalized representation.
 
void normalize_left ()
 Removes extra zeros at the left side to convert the number representation into a semi normalized representation.
 
void clear ()
 ir clears the number digits.
 
int & operator[] (int n)
 Returns the n-th digit of the boost::real::boundary. More...
 
unsigned long size ()
 It return the amount of digit of the boost::real::boundary. More...
 

Public Attributes

std::vector< int > digits = {}
 
int exponent = 0
 
bool positive = true
 

Detailed Description

Explicitly represents a number as a vector of digits with a sign and an exponent.

Author
Laouen Mayal Louan Belloli

Constructor & Destructor Documentation

boost::real::boundary::boundary ( const boundary other)
default

Copy constructor: It construct a new boost::real::boundary that is a copy of the other boost::real::boundary.

Parameters
other- The boost::real::boundary to copy.

Member Function Documentation

std::basic_string<char> boost::real::boundary::as_string ( ) const
inline

Generates a string representation of the boost::real::boundary.

Returns
a string that represent the state of the boost::real::boundary
bool boost::real::boundary::operator< ( const boundary other) const
inline

Lower comparator operator: It compares the *this boost::real::boundary with the other boost::real::boundary to determine if *this is lower than other.

Parameters
other- The right side operand boost::real::boundary to compare with *this.
Returns
a bool that is true if and only if *this is lower than other.
boundary& boost::real::boundary::operator= ( const boundary other)
default

Default asignment operator.

Parameters
other- The boost::real::boundary to copy.
bool boost::real::boundary::operator== ( const boundary other) const
inline

Equality comparator operator: It compares the *this boost::real::boundary with the other boost::real::boundary to determine if *this and other are equals or not.

Parameters
other- The right side operand boost::real::boundary to compare with *this.
Returns
a bool that is true if and only if *this is equal to other.
bool boost::real::boundary::operator> ( const boundary other) const
inline

Greater comparator operator: It compares the *this boost::real::boundary with the other boost::real::boundary to determine if *this is greater than other.

Parameters
other- The right side operand boost::real::boundary to compare with *this.
Returns
a bool that is true if and only if *this is greater than other.
int& boost::real::boundary::operator[] ( int  n)
inline

Returns the n-th digit of the boost::real::boundary.

Parameters
n- an int number indicating the index of the requested digit.
Returns
an integer with the value of the number n-th digit.
void boost::real::boundary::push_back ( int  digit)
inline

add the digit parameter as a new digit of the boost::real::boundary. The digit is added in the right side of the number.

Parameters
digit- The new digit to add.
void boost::real::boundary::push_front ( int  digit)
inline

add the digit parameter as a new digit of the boost::real::boundary. The digit is added in the left side of the number.

Parameters
digit- The new digit to add.
unsigned long boost::real::boundary::size ( )
inline

It return the amount of digit of the boost::real::boundary.

Returns
an unsigne long representing the number of digits of the boost::real::boundary
void boost::real::boundary::swap ( boundary other)
inline

Swaps the boost::real::boundary value with the value of the other boost::real::boundary. This operation is a more preformant form of swapping to boost::real::boundaries.

Parameters
other- The boost::real::boundary to swap with *this.

The documentation for this struct was generated from the following file: