diff --git a/big-int/src/operators/greater_equal.cpp b/big-int/src/operators/greater_equal.cpp index 1df0c16..3aa3111 100644 --- a/big-int/src/operators/greater_equal.cpp +++ b/big-int/src/operators/greater_equal.cpp @@ -32,18 +32,25 @@ namespace libbig { -//! Operator overload for >= for largeInt class -/*! - This operator returns a bool value which is - 1 when the >= condition is satisfied between the two largeInt objects - 0 otherwise -*/ -bool largeInt::operator>=(const largeInt &a) -{ - if(*this>a || *this==a) //! if both > and == conditions are satisfied then >= condition is satified too + /** + * @brief greater equal operator overload for largeInt class. + * + * @param right hand parameter of >= operator + * @return true if *this (object on which this function is + * called upon) is greater or equal else + * false + * + */ + bool largeInt::operator>=(const largeInt &a) + { + /** + * if both > and == conditions are satisfied then >= condition + * is satified too + */ + if(*this>a || *this==a) { - return 1; + return true; } - return 0; -} -} // namespace libbig \ No newline at end of file + return false; + } +} // namespace libbig diff --git a/big-int/src/operators/greater_than.cpp b/big-int/src/operators/greater_than.cpp index 3e8fc58..b1f6ea3 100644 --- a/big-int/src/operators/greater_than.cpp +++ b/big-int/src/operators/greater_than.cpp @@ -32,51 +32,77 @@ namespace libbig { -//! Operator overload for > for largeInt class -/*! - This operator returns a bool value which is - 1 when the > condition is satisfied between the two largeInt objects - 0 otherwise -*/ -bool largeInt::operator>(const largeInt &a) -{ - /** If first number is negative and second number is positive - * then > condition is not satisfied. + /** + * This operator returns a bool value which is + * 1 when the > condition is satisfied between the two largeInt object + * 0 otherwise + */ + bool largeInt::operator>(const largeInt &a) + { + /** + * If first number is negative and second number is positive + * then > condition is not satisfied. + * */ if(this->sign == NEGATIVE && a.sign == POSITIVE) { - return 0; + return false; } - /** If first number is positive and second number is negative - * then > condition is satisfied. + + /** + * If first number is positive and second number is negative + * then > condition is satisfied. + * */ if(a.sign == NEGATIVE && this->sign == POSITIVE) { - return 1; + return true; } - /** If both the numbers have same sign - * then comparing their lengths + + /** + * If both the numbers have same sign + * then comparing their lengths. + * */ if(this->number.length() > a.number.length()) { - return 0^this->sign; //! if first number is longer and both are negative then the condition is satisfied. - } //! but if first number is longer and both are positive then the condition is not satisfied. + /** + * if first number is longer and both are negative then + * the condition is satisfied, but if first number is + * longer and both are positive then the condition is not + * satisfied. + */ + return 0^this->sign; + } if(this->number.length() < a.number.length()) { - return 1^this->sign; //! if first number is shorter and both are negative then the condition is not satisfied. - } //! but if first number is shorter and both are positive then the condition is satisfied. + /** + * if first number is shorter and both are negative then + * the condition is not satisfied, but if first number is + * shorter and both are positive then the condition is + * satisfied. + * + */ + return 1^this->sign; + } - for(int i=0;inumber[i]>a.number[i]) - { - return !(1^this->sign); - } - if(this->number[i]sign); - } + if(this->number[i]>a.number[i]) + { + return !(1^this->sign); + } + if(this->number[i]sign); + } } - return 0; -} + return false; + } } // namespace libbig diff --git a/big-int/src/operators/less_equal.cpp b/big-int/src/operators/less_equal.cpp index 3c5ed86..9099b52 100644 --- a/big-int/src/operators/less_equal.cpp +++ b/big-int/src/operators/less_equal.cpp @@ -32,18 +32,23 @@ namespace libbig { -//! Operator overload for <= for largeInt class -/*! - This operator returns a bool value which is - 1 when the <= condition is satisfied between the two largeInt objects - 0 otherwise -*/ -bool largeInt::operator<=(const largeInt &a) -{ - if(*thissign == NEGATIVE && a.sign == POSITIVE) { - return 1; + return true; } - /** If first number is positive and second number is negative - * then < condition is not satisfied. + + /** + * If first number is positive and second number is negative + * then < condition is not satisfied. + * */ if(a.sign == NEGATIVE && this->sign == POSITIVE) { - return 0; + return false; } - /** If both the numbers have same sign - * then comparing their lengths + + /** + * If both the numbers have same sign + * then comparing their lengths + * */ if(this->number.length() > a.number.length()) { - return 1^this->sign; //! if first number is longer and both are negative then the condition is not satisfied. - } //! but if first number is longer and both are positive then the condition is satisfied. + /** + * if first number is longer and both are negative then the + * condition is not satisfied, but if first number is longer + * and both are positive then the condition is satisfied. + * + */ + return 1^this->sign; + } if(this->number.length() < a.number.length()) { - return 0^this->sign; //! if first number is shorter and both are negative then the condition is satisfied. - } //! but if first number is shorter and both are positive then the condition is not satisfied. + /** + * if first number is shorter and both are negative then the + * condition is satisfied, but if first number is shorter and + * both are positive then the condition is not satisfied. + * + */ + return 0^this->sign; + } - for(int i=0;inumber[i]sign); - } - if(this->number[i]>a.number[i]) - { - return !(0^this->sign); - } + if(this->number[i]sign); + } + if(this->number[i]>a.number[i]) + { + return !(0^this->sign); + } } - return 0; -} + return false; + } } // namespace libbig