System.MulDivInt64
Delphi
function MulDivInt64(AValue, AMul, ADiv: Int64; [out Remainder: Int64]): Int64; overload;
function MulDivInt64(AValue, AMul, ADiv: Int64; [out Remainder: Int64]): Int64; overload;
Properties
| Type | Visibility | Source | Unit | Parent |
|---|---|---|---|---|
| function | public | System.pas | System | System |
Description
Returns the value of this expression: Int64((Int128(AValue) * Int128(AMul)) div Int128(ADiv)).
Int128is a pseudo type thet represents a signed 128-bit integer value.- If you specify the optional parameter
Remainder, this parameter stores the result value of the following expression:Int64((Int128(AValue) * Int128(AMul)) mod Int128(ADiv)).
In the expression A * B div C, if A * B overflows, the result is
invalid. This function calculates the values in 128-bit integer as a workaround for
the potential overflow.