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.

Max class methods

Project: Fractions

Unit: DelphiDabbler.Lib.Fractions

Record: TFraction

Applies to: ~>0.1

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

Description

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

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

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

Example

This example uses the array overload of Max along with the associated Min 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