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.

Min class methods

Project: Fractions

Unit: DelphiDabbler.Lib.Fractions

Record: TFraction

Applies to: ~>0.1

class function Min(const A, B: TFraction): TFraction; overload; static;
class function Min(const FA: array of TFraction): TFraction; overload; static;

Description

These overloaded methods find and return the smallest of a series of fractions.

The first overload returns the smallest of the two given fractions, A and B.

The second method returns the smallest fraction in the given array of fractions, FA. This array must have at least one element.

Example

This example uses the array overload of Min along with the associated Max method to find the smallest range that contains all fractions in a given array.

type
  TFractionRange = record
    Lo, Hi: TFraction;
  end;

function FindRange(const A: array of TFraction): TFRactionRange;
begin
  Result.Lo := TFraction.Min(A);
  Result.Hi := TFraction.Max(A);
end;

See Also