Code sample which successfully implements what I was looking forward to do:
Var
a, b, c: Real;
begin
a := StrToFloat(txt1.Text);
b := INT(a);
c := frac(ABS(a)) + 0.000000000000001;
Full code sample:
unit Unit10;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;
type
TfrmM4E1 = class(TForm)
btn1: TButton;
lbl1: TLabel;
txt1: TEdit;
lbl2: TLabel;
procedure btn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmM4E1: TfrmM4E1;
implementation
{$R *.dfm}
procedure TfrmM4E1.btn1Click(Sender: TObject);
Var
a, b, c: Real;
begin
a := StrToFloat(txt1.Text);
b := INT(a);
c := frac(ABS(a)) + 0.000000000000001;
lbl1.Caption := FloatToStr(b);
lbl2.Caption := FloatToStr(c);
end;
end.
Quick explanation: this is the code implementation of a UI, which has a button, a text field (which get the fractional value), and two labels, one of them displays the integer portion of the entered number, and the other label, displays the fractional portion of the entered number.
Variable "a" stores the inserted value;
Variable "b" stores the integer value from variable "a";
Variable "c" stores the fractional value from variable "a", plus a number correction since "c" lacks 0.000000000000001 in the displayed final value.
Finally, labels "lbl1", and "lbl2" shows the values of variables "b" and "c", respectivaly.