| LCM Function |
Unit
QESBPCSMath
Declaration
Function LCM(const X, Y: LongInt): Int64;
Description
Please note that routine assumes LCM (0, 0) to be invalid and raises an error;
| Parameters |
| X | First Value to process. |
| Y | Second Value to process. |
Category
Arithmetic Routines for IntegersImplementation
function LCM (const X, Y: LongInt): Int64;
begin
if (X = 0) or (Y = 0) then
raise EMathError.Create (rsNotDefinedForValue);
Result := (x div LongInt (GCD (Abs (X), Abs (Y)))) * Int64 (Y);
End; |
|
|