an algorithm for step division

From Sharkysoft Wiki
Revision as of 17:17, 20 May 2011 by Sharky (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Under construction.

int stepDivide(int iDividend, int iDivisor)
{
    if (iDivisor < 0)
        return stepDivide(- iDividend, - iDivisor);
    int vQuotient;
    if (iDividend >= 0)
        vQuotient = iDividend / iDivisor;
    else
        vQuotient = (iDividend - iDivisor + 1) / iDivisor;
    return vQuotient;
}
Personal tools
Namespaces

Variants
Actions
Navigation
Tools