Mega Code Archive

 
Categories / Delphi / Functions
 

Isinfinite - 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 Infinity Floating point value of infinite size IsNaN Checks to see if a floating point number holds a real number NaN Not a real number 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