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

void ratio::setRatio ( int  pinteger,
int  pnumerator,
int  pdenominator,
bool  reduce = true 
)

set new ratio using mixed numbers; reducing will be done after numerator and denominator were set!

Definition at line 146 of file ratio.cpp.

References setRatio().

{
    // calculate new Numerator, but ignore negative values
    int newNumerator = qAbs (pinteger * pdenominator) + qAbs (pnumerator);

    // restore negative values
    if ( (pinteger < 0 || pnumerator < 0) && ! (pinteger < 0 && pnumerator < 0))
        newNumerator *= -1;

    setRatio (newNumerator, pdenominator, reduce_it);

    return;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index