an algorithm for step division

From Sharkysoft Wiki
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