Welcome to the new DelphiDabbler Code Library Documentation.

This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.

Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.

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;