int MulDiv(nMultiplicand, nMultiplier, nDivisor) | |||||
int nMultiplicand; | /* 16-bit signed multiplicand | */ | |||
int nMultiplier; | /* 16-bit signed multiplier | */ | |||
int nDivisor; | /* 16-bit signed divisor | */ |
The MulDiv function multiplies two 16-bit values, and then divides the 32-bit result by a third 16-bit value. The return value is the 16-bit result of the division, rounded up or down to the nearest integer.
nMultiplicand
Specifies the multiplicand.
nMultiplier
Specifies the multiplier.
nDivisor
Specifies the number by which the result of the multiplication (nMultiplicand * nMultiplier) is to be divided.
The return value is the result of the multiplication and division if the function is successful. The return value is -1 if either an overflow occurred or nDenominator was zero.