How to check if floating point is NaN in Pascal

1 Answer

0 votes
program IsNanProgram;

uses
  Math; // IsNan

var
  value: Double;
begin
  value := 0.0 / 0.0; // Generating a NaN
  if IsNan(value) then
    WriteLn('The value is NaN')
  else
    WriteLn('The value is not NaN');
end.




(*
run:
  
The value is NaN

*)

 



answered Aug 3, 2025 by avibootz
...