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.
Applies to: ~>0.1
function Sign: TValueSign;
This method returns a value representing the sign of the fraction. The return values are:
These values are constants defined in the Math unit as
Low(TValueSign) respectively. TValueSign is itself defined as
var F: TFraction; begin F := TFraction.Create(2, 3); Assert(F.Sign = Math.PositiveValue); F := 0; Assert(F.Sign = Math.ZeroValue); F := TFraction.Create(-2, 3); Assert(F.Sign = Math.NegativeValue); end;
You can also check the sign by using the overloaded
< operators to compare a TFraction to zero, as in:
var F: TFraction; begin // set up F here if F > 0 then // positive else if F < 0 then // negative else begin Assert(F = 0); // zero end;