src/HumNum.cpp
void HumNum::reduce(void) {
	int a = getNumerator();
	int b = getDenominator();
	if (a == 1 || b == 1) {
		return;
	}
	if (a == 0) {
		bot = 1;
		return;
	}
	if (b == 0) {
		a = 0;
		b = 0;
	}
	int gcdval = gcdIterative(a, b);
	if (gcdval > 1) {
		top /= gcdval;
		bot /= gcdval;
	}
}
//////////////////////////////
//
// HumNum::reduce -- simplify the fraction.  For example, 4/24 will
//    reduce to 1/6 since a factor of 4 is common to the numerator
//    and denominator.
//
:reduce -- simplify the fraction.  For example, 4/24 will
reduce to 1/6 since a factor of 4 is common to the numerator
and denominator.
: reduce -- simplify the fraction . For example 4 / 24 will reduce to 1 / 6 since a factor of 4 is common to the numerator and denominator .
void HumNum::reduce(void) {
	int a = getNumerator();
	int b = getDenominator();
	if (a == 1 || b == 1) {
		return;
	}
	if (a == 0) {
		bot = 1;
		return;
	}
	if (b == 0) {
		a = 0;
		b = 0;
	}
	int gcdval = gcdIterative(a, b);
	if (gcdval > 1) {
		top /= gcdval;
		bot /= gcdval;
	}
}
void HumNum :: reduce ( void ) { int a = getNumerator ( ) ; int b = getDenominator ( ) ; if ( a == 1 || b == 1 ) { return ; } if ( a == 0 ) { bot = 1 ; return ; } if ( b == 0 ) { a = 0 ; b = 0 ; } int gcdval = gcdIterative ( a , b ) ; if ( gcdval > 1 ) { top /= gcdval ; bot /= gcdval ; } }
HumNum::reduce -- simplify the fraction.
HumNum :: reduce -- simplify the fraction .