Checks to see if a floating point number holds a real number Math unit
 function IsNaN(const Float Single | Double | Extended):Boolean;
The IsNaN function returns True if the Float parameter is Not a number.
A floating point number can be set to such a value when it is assigned an undetermined value. The standard is :
NAN = 0.0 / 0.0
Related commands
InfinityFloating point value of infinite size
IsInfiniteChecks whether a floating point number is infinite
NaNNot a real number
 Download this web site as a Windows program.

Example code : Assign NAN to a number and then test using IsNaN
  float : Double;

  // Set the number to an invalid number
  float := NAN;    // Equivalent to 0.0/0.0

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

  // And we can test to see if it is a valid number
  if IsNaN(float)
  then ShowMessage('float is not a number')
  else ShowMessage('float = '+FloatToStr(float));
Show full unit code
  float = NAN
  float is not a number
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page