[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'LCLType' (#lcl)

MulDiv

Multiples the numerator by the specified Integer value, and divides the result by the denominator value.

Declaration

Source position: lcltype.pp line 3006

function MulDiv(

  nNumber: Integer;

  nNumerator: Integer;

  nDenominator: Integer

):Integer;

Arguments

nNumber

  

Multiplicand for the operation.

nNumerator

  

Numerator multiplied by the specified value.

nDenominator

  

Denominator used for the division operation.

Function result

Integer result for the multiply and divide operations.

Description

Values passed in the arguments to the routine are Integer types. Values in nNumber and nNumerator are cast to Int64 values for the multiplication operation. MathRound is called to ensure that the result for the division operation is rounded for the Int64 type, and is cast to the Integer type used in the return value.

When nNumerator and nDenominator have the same value, the return value is set to nNumber. The return value is -1 if the value in nDenominator is 0 (zero).


Version 3.2 Generated 2024-02-25 Home