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.

Numerator property

Project: Fractions

Unit: DelphiDabbler.Lib.Fractions

Record: TFraction

Applies to: ~>0.1

property Numerator: Int64;

Description

This property provides the numerator of a fraction encapsulated by a TFraction.

The property can be any 64 bit integer value.

The sign of the numerator is the same as the sign of the fraction.

Example

var
  F: TFraction;
begin
  F := TFraction.Create(2, 3);
  Assert(F.Numerator = 2);   // F = 2/3
  F := -F;
  Assert(F.Numerator = -2);  // F = -2/3
  F := 0.75;
  Assert(F.Numerator = 3);   // F = 3/4
  F := 42;
  Assert(F.Numerator = 42);  // F = 42/1
end;

See Also