(* Collection of code snippets by Arne Vajhøj *)
(* (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) *)
program testisint;

{$APPTYPE CONSOLE}

uses
  SysUtils;

function isint1(x : single) : boolean;

begin
   isint1 := (round(x)=x);
end;

function isint2(x : single) : boolean;

begin
   isint2 := (abs(round(x)-x) < 0.00001);
end;

function isint3(x : single) : boolean;

begin
   isint3 := (frac(x)=0);
end;

procedure test(x : single);

begin
   writeln(x:7:5,' ',isint1(x):5,' ',isint2(x):5,' ',isint3(x):5);
end;

var
   i : integer;
   x : single;

begin
   test(123);
   test(123.456);
   test(122.9999);
   test(123.0001);
   test(122.999999);
   test(123.000001);
   for i:=1 to 1000 do begin
      x := 1/i;
      x := i*x;
      if (isint1(x)<>isint2(x)) or (isint2(x)<>isint3(x)) then begin
         writeln(i:3,' ',x:9:7,' ',isint1(x):5,' ',isint2(x):5,' ',isint3(x):5);
      end;
   end;
end.
