Hash method

Project: Fractions

Unit: DelphiDabbler.Lib.Fractions

Record: TFraction

Applies to: ~>0.2

function Hash: Integer;

Description

Computes and returns a hash value for the fraction as an Integer.

If two fractions that simplify to the same fraction have the same hash.

Example

var
  F, G: TFraction;
begin
  F := TFraction.Create(1, 2);
  G := TFraction.Create(3, 6);
  Assert(F.Hash = G.Hash);
end;