diff --git a/include/real/boundary.hpp b/include/real/boundary.hpp index 55628d6..55df571 100644 --- a/include/real/boundary.hpp +++ b/include/real/boundary.hpp @@ -18,12 +18,12 @@ namespace boost { bool positive = true; /** - * @brief *default constructor*: It constructs a representation of the number zero. + * @brief *default constructor*: It construct a representation of the number zero. */ boundary() = default; /** - * @brief *Copy constructor:* It constructs a new boost::real::boundary that is a copy of the + * @brief *Copy constructor:* It construct a new boost::real::boundary that is a copy of the * other boost::real::boundary. * * @param other - The boost::real::boundary to copy. @@ -109,7 +109,7 @@ namespace boost { /** * @brief Generates a string representation of the boost::real::boundary. * - * @return a string that represents the state of the boost::real::boundary + * @return a string that represent the state of the boost::real::boundary */ std::basic_string as_string() const { std::basic_string result = ""; @@ -118,7 +118,7 @@ namespace boost { result = "-"; } - // If the number is too large, scientific notation is used to print it. + // If the number is to large, scientific notation is used to print it. if ((this->exponent < -10) || (this->exponent > (int)this->digits.size() + 10)) { result += "0."; @@ -247,9 +247,9 @@ namespace boost { } /** - * @brief It returns the number of digits of the boost::real::boundary + * @brief It return the amount of digit of the boost::real::boundary * - * @return an unsigned long representing the number of digits of the boost::real::boundary + * @return an unsigne long representing the number of digits of the boost::real::boundary */ unsigned long size() { return this->digits.size(); diff --git a/include/real/boundary_helper.hpp b/include/real/boundary_helper.hpp index ae4b242..0bfec7e 100644 --- a/include/real/boundary_helper.hpp +++ b/include/real/boundary_helper.hpp @@ -19,7 +19,7 @@ namespace boost { * @param lhs - a std::vector used as the left side operand * @param rhs - a std::vector used as the right side operand * - * @return a bool that is true if and only if, the number represented by lsh is lower than + * @return a bool that is true if and only if, the represented number by lsh is lower than * the represented number by rhs. */ bool aligned_vectors_is_lower(const std::vector &lhs, const std::vector &rhs) { diff --git a/include/real/interval.hpp b/include/real/interval.hpp index d4b9151..462d0fd 100644 --- a/include/real/interval.hpp +++ b/include/real/interval.hpp @@ -20,15 +20,15 @@ namespace boost { boost::real::boundary upper_bound; /** - * @brief *default constructor*: It constructs a representation of the interval [0,0]. + * @brief *default constructor*: It construct a representation of the interval [0,0]. */ interval() = default; /** * @brief Generates a string representation of the boost::real::interval. - * The string represents the interval with the format [lower boundary, upper boundary] + * The string represent the interval with the format [lower boundary, upper boundary] * - * @return a string that represents the state of the boost::real::interval. + * @return a string that represent the state of the boost::real::interval. */ std::string as_string() const { @@ -47,7 +47,7 @@ namespace boost { /** * @brief Swaps the lower boundary with the upper boundary. After this method is called - * the boost::real::interval boundaries are swapped. + * the boost::real::interval boundaries are swaped. */ void swap_bounds() { this->lower_bound.swap(this->upper_bound); @@ -84,7 +84,7 @@ namespace boost { */ bool positive() const { // If the lower bound of a approximation_interval is positive, then the upper bound is also positive - // and the approximation_interval is fully contained in the positive number line. + // and the approximation_interval is fully contained in the positive number line return this->lower_bound.positive; } @@ -95,7 +95,7 @@ namespace boost { */ bool negative() const { // If the upper bound of a approximation_interval is negative, then the lower bound is also negative - // and the approximation_interval is fully contained in the negative number line. + // and the approximation_interval is fully contained in the negative number line return !this->upper_bound.positive; } @@ -103,17 +103,17 @@ namespace boost { * @brief Equality comparator. Determines if *this is equal or not to other. * * @param other - a boost::real::interval to compare to *this. - * @return a bool that is true if and only if *this and other boundaries are equals. + * @return a bool that is true if and only if *this and equal boundaries are equals. */ bool operator==(const boost::real::interval& other) const { return this->lower_bound == other.lower_bound && this->upper_bound == other.upper_bound; } /** - * @brief Determines if the interval represents a single number. i.e. the lower and upper + * @brief Determines if the interval represent a single number. i.e. the lower and upper * boundaries are equals. * - * @return a bool that is true if and only if the interval represents a single number. + * @return a bool that is true if and only if the interval represent a single number. */ bool is_a_number() const { return this->lower_bound == this->upper_bound; diff --git a/include/real/irrational_helpers.hpp b/include/real/irrational_helpers.hpp index 38fff84..fe038a2 100644 --- a/include/real/irrational_helpers.hpp +++ b/include/real/irrational_helpers.hpp @@ -13,7 +13,7 @@ namespace boost { * binary integer version. * * @param n - The number digit index. - * @return The value of the champernowne number n-th digit (either 0 or 1) + * @return The value if the champernowne number n-th digit (either 0 or 1) */ int champernowne_binary_get_nth_digit(unsigned int n) { std::vector binary = {1}; diff --git a/include/real/irrationals.hpp b/include/real/irrationals.hpp index 72260fa..31750cf 100644 --- a/include/real/irrationals.hpp +++ b/include/real/irrationals.hpp @@ -11,7 +11,7 @@ namespace boost { /** * @brief The Champernowne is a transcendental real constant whose digits are formed by - * consecutively concatenated representations of sucessive integers in a determined base. + * consecutively concatenate representations of sucessive integers in a determined base. * In this function, a binary base is used. */ boost::real::real CHAMPERNOWNE_BINARY(boost::real::irrational::champernowne_binary_get_nth_digit, 0); diff --git a/include/real/real.hpp b/include/real/real.hpp index 21b6dd2..434b631 100644 --- a/include/real/real.hpp +++ b/include/real/real.hpp @@ -95,7 +95,7 @@ namespace boost { * * @brief is a forward iterator that iterates a boost::real::real number approximation * intervals. The iterator calculates the initial interval with the initial precision and - * then it increases the precision in each iteration (++) and recalculates the interval. + * then it increase the precision in each iteration (++) and recalculate the interval. */ class const_precision_iterator { private: @@ -294,7 +294,7 @@ namespace boost { * @brief *Pointer constructor:* Construct a new boost::real::real::const_precision_iterator * pointing to the boost::real::real number to iterate the number approximation intervals. * - * The iterator will start pointing to the lowest precision interval. + * The iterator will start pointing the lowest precision interval. * * @param real_number - the boost::real::real number to iterate. */ @@ -397,7 +397,7 @@ namespace boost { }; /** - * @brief It compares by value equality; two boost::real::real::const_precision_iterators + * @brief It compare by value equality; two boost::real::real::const_precision_iterators * are equals if they are pointing to the same real number and are in the same precision iteration. * * @param other - A boost::real::real::const_precision_iterator that is the right side operand @@ -413,7 +413,7 @@ namespace boost { } /** - * @brief It compares by value not equal; two boost::real::real::const_precision_iterators. + * @brief It compare by value not equal; two boost::real::real::const_precision_iterators. * * @param other - A boost::real::real::const_precision_iterator that is the right side operand * @return a bool that is true if and only if both iterators are not equals. @@ -424,10 +424,10 @@ namespace boost { }; /** - * @brief *Default constructor:* Construct a boost::real::real with undefined representation + * @brief *Default constructor:* Constructr a boost::real::real with undefined representation * and behaviour. * - * @note This constructor exists to allow working with other libraries as std::map or std::tuple + * @note This constructor exist to allow working with other libraries as std::map or std::tuple */ real() = default; @@ -458,7 +458,7 @@ namespace boost { /** * @brief *Initializer list constructor:* Creates a boost::real::real_explicit instance - * that represents an integer number where all the digits parameter numbers are from + * that represents an integer number where all the digits parameter numbers are form * the integer part in the same order. The number is set as positive. * * @param digits - a initializer_list that represents the number digits. @@ -474,7 +474,7 @@ namespace boost { * the same order. * * @param digits - an initializer_list that represent the number digits. - * @param positive - a bool that represents the number sign. If positive is set to true, + * @param positive - a bool that represent the number sign. If positive is set to true, * the number is positive, otherwise is negative. */ real(std::initializer_list digits, bool positive) @@ -722,7 +722,7 @@ namespace boost { } /** - * @brief It assigns a new copy of the other boost::real::real number in the *this boost::real::real number. + * @brief It assign a new copy of the other boost::real::real number in the *this boost::real::real number. * * @param other - the boost::real::real number to copy. * @return a reference of *this with the new represented number. @@ -736,8 +736,8 @@ namespace boost { } /** - * @brief It constructs a boost::real::real number from the std::string and assigns it - * to the *this boost::real::real number. + * @brief It constructs and boost::real::real number from the std::string and assign it + * in the *this boost::real::real number. * * @param number - a valid string representing a number. * @return a reference of *this with the new represented number. diff --git a/include/real/real_algorithm.hpp b/include/real/real_algorithm.hpp index 4586823..605d3ba 100644 --- a/include/real/real_algorithm.hpp +++ b/include/real/real_algorithm.hpp @@ -18,7 +18,7 @@ namespace boost { */ class real_algorithm { - // Number representation as a function that returns the number digits + // Number representation as a function that return the number digits // an integer part and a sign (+/-) int (*_get_nth_digit)(unsigned int); int _exponent; @@ -36,7 +36,7 @@ namespace boost { * * @brief is a forward iterator that iterates a boost::real::real_algorithm number approximation * intervals. The iterator calculates the initial interval with the initial precision and - * then it increases the precision in each iteration (++) and recalculates the interval. + * then it increase the precision in each iteration (++) and recalculate the interval. */ class const_precision_iterator { private: @@ -77,7 +77,7 @@ namespace boost { * @brief *Pointer constructor:* Construct a new boost::real::real_algorithm::const_precision_iterator * pointing to the boost::real::real_algorithm number to iterate the number approximation intervals. * - * The iterator will start pointing to the lowest precision interval. + * The iterator will start pointing the lowest precision interval. * * @param real_number - the boost::real::real number to iterate. */ @@ -152,7 +152,7 @@ namespace boost { } /** - * @brief It compares by value equality; two boost::real::real_algorithm::const_precision_iterators + * @brief It compare by value equality; two boost::real::real_algorithm::const_precision_iterators * are equals if they are pointing to the same real number and are in the same precision iteration. * * @param other - A boost::real::real_algorithm::const_precision_iterator that is the right side operand @@ -170,7 +170,7 @@ namespace boost { } /** - * @brief It compares by value not equal; two boost::real::real_algorithm::const_precision_iterators. + * @brief It compare by value not equal; two boost::real::real_algorithm::const_precision_iterators. * * @param other - A boost::real::real_algorithm::const_precision_iterator that is the right side operand * @return a bool that is true if and only if both iterators are not equals. @@ -200,7 +200,7 @@ namespace boost { * this function returns the n-th number digit. The number is positive. * * @param get_nth_digit - a function pointer or lambda function that given an unsigned - * int "n" as parameter, returns the number n-th digit. + * int "n" as parameter, it returns the number n-th digit. * @param exponent - an integer representing the number exponent. */ explicit real_algorithm(int (*get_nth_digit)(unsigned int), int exponent) @@ -214,7 +214,7 @@ namespace boost { * is positive or negative. * * @param get_nth_digit - a function pointer or lambda function that given an unsigned - * int "n" as parameter, returns the number n-th digit. + * int "n" as parameter, it returns the number n-th digit. * @param exponent - an integer representing the number exponent. * @param positive - a bool that represent the number sign. If positive is set to true, * the number is positive, otherwise is negative. diff --git a/include/real/real_exception.hpp b/include/real/real_exception.hpp index 681018f..8055be5 100644 --- a/include/real/real_exception.hpp +++ b/include/real/real_exception.hpp @@ -8,7 +8,7 @@ namespace boost { struct precision_exception : public std::exception { const char * what () const throw () override { - return "The boost::real number precision is too slow to compare both numbers"; + return "The boost::real number precision is to slow to compare both numbers"; } }; diff --git a/include/real/real_explicit.hpp b/include/real/real_explicit.hpp index c1c32eb..424137e 100644 --- a/include/real/real_explicit.hpp +++ b/include/real/real_explicit.hpp @@ -28,7 +28,7 @@ namespace boost { int _exponent = 1; bool _positive = true; - // The number max precision is the same as the explicit number digits size. + // The number max precision is the same as the explicit number digits size unsigned int _maximum_precision = 1; public: @@ -37,7 +37,7 @@ namespace boost { * * @brief 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 increases the precision in each iteration (++) and recalculates the interval. + * then it increase the precision in each iteration (++) and recalculate the interval. */ class const_precision_iterator { private: @@ -119,7 +119,7 @@ namespace boost { // If the explicit number full precision has been already reached (the end) // is the end of the iterator if (this->_n >= (int)this->_real_ptr->_digits.size()) { - // TODO: Remove commented lines that are depreciated code + // TODO: Remove commented lines that are deprecatod code //this->approximation_interval.lower_bound.push_back(0); //this->approximation_interval.upper_bound.push_back(0); //this->_n++; @@ -132,7 +132,7 @@ namespace boost { this->check_and_swap_boundaries(); // If the explicit number just reaches the full precision (the end) - // then set both boundaries are equals. + // then set both boundaries are equals if (this->_n + n >= (int)this->_real_ptr->_digits.size()) { for(int i = this->_n; i < (int)this->_real_ptr->_digits.size(); i++) { @@ -180,7 +180,7 @@ namespace boost { } /** - * @brief It compares by value equality; two boost::real::real_explicit::const_precision_iterators + * @brief It compare by value equality; two boost::real::real_explicit::const_precision_iterators * are equals if they are pointing to the same real number and are in the same precision iteration. * * @param other - A boost::real::real_explicit::const_precision_iterator that is the right side operand @@ -198,7 +198,7 @@ namespace boost { } /** - * @brief It compares by value not equal; two boost::real::real_explicit::const_precision_iterators. + * @brief It compare by value not equal; two boost::real::real_explicit::const_precision_iterators. * * @param other - A boost::real::real_explicit::const_precision_iterator that is the right side operand * @return a bool that is true if and only if both iterators are not equals. @@ -209,7 +209,7 @@ namespace boost { }; /** - * @brief *Default constructor:* Constructs an empty boost::real::real_explicit with + * @brief *Default constructor:* Construct an empty boost::real::real_explicit with * undefined representation and behaviour. */ real_explicit() = default; @@ -223,7 +223,7 @@ namespace boost { /** * @brief *String constructor:* Creates a boost::real::real_explicit instance by - * parsing the string. The string must have a valid number, otherwise, the + * parsing the string. The string must have a valid number, in other case, the * constructor will throw an boost::real::invalid_string_number exception. * * @param number - a valid string representing a number. @@ -250,7 +250,7 @@ namespace boost { int exponent = 0; dot_amount = 0; - // Check whether the number is explicitly specified as positive or negative. + // Check whether the number is explicitly specified as positive or negative unsigned int first_index = 0; if (number.at(first_index) == '+') { this->_positive = true; @@ -261,7 +261,7 @@ namespace boost { } // Remove zeros from the lefts side - // Note: We know at this point that number.length > 0 because of the first check + // Note: We know at this point that number.length > 0 because the first check unsigned int last_index = (unsigned int)number.length() - 1; while (last_index > first_index && (number.at(last_index) == '0' || number.at(last_index) == '.')) { if (number.at(last_index) == '.') { @@ -273,7 +273,7 @@ namespace boost { } } - // If the number is composed by all zeros, then it is zero. + // The number is all composed by zeros, then it is zero if (last_index == first_index && number.at(last_index) == '0') { this->_digits = {0}; this->_exponent = 0; @@ -281,7 +281,7 @@ namespace boost { } // Remove zeros from the right side - // Note: If the number is all made by zeros, then the code never reaches this part + // Note: if the number is all made by zeros, then the code never reaches this part // This is why we don't need to check that first_index is lower than the string length while (number.at(first_index) == '0') { first_index++; @@ -324,7 +324,7 @@ namespace boost { * integer part and the elements of the digits list are the digits the number in the same order. * The number is set as positive. * - * @param digits - an initializer_list that represents the number digits. + * @param digits - an initializer_list that represent the number digits. * @param exponent - an integer representing the number exponent. */ real_explicit(std::initializer_list digits, int exponent) : @@ -337,12 +337,12 @@ namespace boost { * @brief *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 of the number in the same order. This constructor uses the sign to determine + * digits the number in the same order. This constructor uses the sign to determine * if the number is positive or negative. * - * @param digits - an initializer_list that represents the number digits. + * @param digits - an initializer_list that represent the number digits. * @param exponent - an integer representing the number exponent. - * @param positive - a bool that represents the number sign. If positive is set to true, + * @param positive - a bool that represent the number sign. If positive is set to true, * the number is positive, otherwise is negative. */ real_explicit(std::initializer_list digits, int exponent, bool positive): @@ -353,10 +353,10 @@ namespace boost { {}; /** - * @brief Returns the maximum allowed precision, if that precision is reached and an - * operator needs more precision, a precision_exception should be thrown. + * @brief Returns te maximum allowed precision, if that precision is reached and an + * operator need more precision, a precision_exception should be thrown. * - * @return an integer with the maximum allowed precision. + * @return and integer with the maximum allowed precision. */ unsigned int max_precision() const { return this->_maximum_precision; @@ -396,7 +396,7 @@ namespace boost { * @brief Construct a new boost::real::real_explicit::const_precision_iterator that iterates the number * approximation intervals in increasing order according to the approximation precision. * - * The iterator starts pointing to the interval with the minimum precision. + * The iterator starts pointing the interval with the minimum precision. * * @return a boost::real::real_explicit::const_precision_iterator of the number. */ @@ -405,10 +405,10 @@ namespace boost { } /** - * @brief Constructs a new boost::real::real_explicit::const_precision_iterator that iterates the number + * @brief Construct a new boost::real::real_explicit::const_precision_iterator that iterates the number * approximation intervals in increasing order according to the approximation precision. * - * The iterator starts pointing to the interval with the maximum allowed precision. + * The iterator starts pointing the interval with the maximum allowed precision. * * @return a boost::real::real_explicit::const_precision_iterator of the number. */ @@ -433,7 +433,7 @@ namespace boost { } /** - * @brief It assigns a new copy of the other boost::real::real_explicit number in the *this boost::real::real_explicit number. + * @brief It assign a new copy of the other boost::real::real_explicit number in the *this boost::real::real_explicit number. * * @param other - the boost::real::real_explicit number to copy. * @return a reference of *this with the new represented number. diff --git a/include/real/real_helpers.hpp b/include/real/real_helpers.hpp index d362d3a..e5d0edb 100644 --- a/include/real/real_helpers.hpp +++ b/include/real/real_helpers.hpp @@ -20,7 +20,7 @@ namespace boost { * @author Laouen Mayal Louan Belloli * * @brief Implement the addition between two std::vector that represent numbers. - * The numbers in the vectors are the digits and each vector has a corresponding exponent + * The numbers in the vectors are the digit and each vector has a corresponding exponent * to correctly align the vectors for the addition. * * @param lhs - a std::vector representing the left operand. diff --git a/test/real_explicit_iterator_unit_test.cpp b/test/real_expicit_iterator_unit_test.cpp similarity index 100% rename from test/real_explicit_iterator_unit_test.cpp rename to test/real_expicit_iterator_unit_test.cpp