unit SystemFrac;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    ListBox1: TListBox;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: SystemFrac
// Routine: System.Frac

// BeginCode
{
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.
}
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;
// EndCode
// EndExample: SystemFrac
end.
