Nan - just a hint lazarus / 21-General ---------------------------------------------------------------------- mtanner · 2022-04-18 08:22 Thought I'd post this just as a hint for others. Just spent some wasted time tracking down an exception in some code, chasing down various possible pointer and class reference errors in my somehat complex program structure. Turns out I had foolishly coded If X=Nan ...... instead of the correct If IsNan(X) ... Compiler did not flag the error, got an exception at runtime. Just to highlight my carelessness, I had actually coded If (X=Nan) or IsNan(Y) then ... so why I coded two phrases differently is a mystery. Hope this hint saves someone else a bit of time. ---------------------------------------------------------------------- PascalDragon · 2022-04-18 10:41 Quote from: mtanner on April 18, 2022, 10:22:26 amCompiler did not flag the error, got an exception at runtime. There is nothing for the compiler to flag, cause from the compiler's point of view it simply isn't an error. However the value of NaN might be a different NaN value from the one generated during calculations (e.g. signaling NaN vs. non-signaling NaN) and thus you need to use IsNaN instead of comparing with NaN directly.