DelphiBasics
Infinity
Constant
Floating point value of infinite size Math unit
  const Infinity =  1.0 / 0.0;
Description
The Infinity constant is a special floating point number, marked as infinite in size.
 
It may be assigned and calculated upon, but use IsInfinite for comparisons.
Related commands
IsInfinite Checks whether a floating point number is infinite
IsNaN Checks to see if a floating point number holds a real number
NaN Not a real number
 Author links

 Buy Website Traffic at
 Buywebsitetrafficexperts.com

 Buy Proxies at
 Buyproxies.io
 
 Download this web site as a Windows program.




 
Example code : Illustrate use of Infinity
// Full Unit code.
// -----------------------------------------------------------
// You must store this code in a unit called Unit1 with a form
// called Form1 that has an OnCreate event called FormCreate.
 
unit Unit1;
 
interface
 
uses
  Math,   // Unit containing the Infinity command
  SysUtils,
  Forms, Dialogs;
 
type
  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
  end;
 
var
  
Form1: TForm1;
 
implementation
{$R *.dfm} // Include form definitions
 
procedure TForm1.FormCreate(Sender: TObject);

var
  float1, float2 : single;
begin
  float1 := Infinity;
  float2 := 23;

  ShowMessage('float1 = '+FloatToStr(float1));
  ShowMessage('float2 = '+FloatToStr(float2));
  ShowMessage('float1 - float2 = '+FloatToStr(float1 - float2));
  ShowMessage('-float1 = '+FloatToStr(-float1));
end;
 
end.
Hide full unit code
   float1 = INF
   float2 = 23
   float1 - float2 = INF
   -float1 = -INF
 
Delphi Programming Neil Moffatt 2002 - 2017. All rights reserved.  |  Home Page