Logo Search packages:      
Sourcecode: kbruch version File versions  Download package

bool ratio::operator> ( ratio  right )

compares the current ratio with a given one

Definition at line 289 of file ratio.cpp.

References denominator(), m_denominator, m_numerator, numerator(), and ratio().

{
    signed short sign = 1;
    ratio tmp_ratio = ratio (m_numerator, m_denominator) - right;

    // check for this == right
    if (tmp_ratio == ratio (0, 1))
        return false;

    // get the presign of the diff
    if (tmp_ratio.numerator() < 0)
        sign = -1;
    if (tmp_ratio.denominator() < 0)
        sign *= -1;

    // if the diff is positive, this is smaller than right
    if (sign < 0) {
        return false;
    } else {
        return true;
    }
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index