DelphiBasics
IsInfinite
Function
Checks whether a floating point number is infinite Math unit
 function IsInfinite(const FloatNumber Double):Boolean;
Description
The IsInfinite function returns True if FloatNumber is infinite in value.
Related commands
InfinityFloating point value of infinite size
IsNaNChecks to see if a floating point number holds a real number
NaNNot a real number
 Download this web site as a Windows program.




 
Example code : Assign Infinity to a number and then test using IsInfinite
var
  float : Double;

begin
  // Set the number to infinity
  float := Infinity;    // Equivalent to 1.0/0.0

  // Although infinite, we can still display it
  ShowMessage('float = '+FloatToStr(float));

  // And we can test to see if it is infinite
  if IsInfinite(float)
  then ShowMessage('float is infinite')
  else ShowMessage('float = '+FloatToStr(float));
end;
Show full unit code
  float = INF
  float is infinite
 
Delphi Programming © Neil Moffatt 2002 - 2022. All rights reserved.  |  Home Page