MulDiv Function

The MulDiv function multiplies two 32-bit values and then divides the 64-bit result by a third 32-bit value. The return value is rounded up or down to the nearest integer.

Syntax

C++
int MulDiv(
  __in  int nNumber,
  __in  int nNumerator,
  __in  int nDenominator
);

Parameters

nNumber [in]

Multiplicand.

nNumerator [in]

Multiplier.

nDenominator [in]

Number by which the result of the multiplication is to be divided.

Return Value

If the function succeeds, the return value is the result of the multiplication and division. If either an overflow occurred or nDenominator was 0, the return value is –1.

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinbase.h (include Windows.h)
LibraryKernel32.lib
DLLKernel32.dll

See Also

Large Integers
Int32x32To64
UInt32x32To64

Build date: 7/30/2009

Tags :


Page view tracker