SystemFrac (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

This example illustrates the use of the System Frac function. The number in the text edit can be a negative or positive real number. Notice how the type passed (R) matters.

Code

procedure TForm1.Button1Click(Sender: TObject);
var
 R: Extended;
begin
  R := StrToFloat(Edit1.Text);
  ListBox1.Items.Add(FloatToStr(Frac(R)));
end;

procedure TForm1.Button2Click(Sender: TObject);
var
 R: Real;
begin
  R := StrToFloat(Edit1.Text);
  ListBox1.Items.Add(FloatToStr(Frac(R)));
end;

Uses

Personal tools
Assistance