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.
Project: Fractions
Unit: DelphiDabbler.Lib.Fractions
Record: TFraction
Applies to: ~>0.1
function IsProper: Boolean;
The IsProper method checks if a TFraction instance is a proper fraction and returns True if so or False if not.
A proper fraction is one whose absolute value is less than 1, i.e. the absolute value of its numerator is less than its denominator.
var
F: TFraction;
begin
F := TFraction.Create(-2, 3);
Assert(F.IsProper);
F := TFraction.Create(3, 4);
Assert(F.IsProper);
F := TFraction.Create(7, 4);
Assert(not F.IsProper);
end;
Another test for a proper fraction is to check whether its WholeNumberPart property is 0. If the property is 0 then the fraction is proper, otherwise it is not.