Avatar of BdLm
BdLm
Flag for Germany

asked on 

NAN problem in D7

I got an NAN issue:
background info : i  have a line of code    a=0;  a bit later wo any access to a,  a is changed to 1,23324213E-301  and a bit later a=NAN????

a) any good Idea where this comes from
b) I need a workaround and check if a=NAN  is this the best code I found on the net ....
// Since a NAN is not a single, unique value, a special function is
// needed for this test
FUNCTION IsNAN(CONST d: DOUBLE): BOOLEAN;
  VAR
    Overlay: Int64 ABSOLUTE d;
BEGIN
  RESULT := 
    ((Overlay AND $7FF0000000000000)  = $7FF0000000000000) AND
    ((Overlay AND $000FFFFFFFFFFFFF) <> $0000000000000000)
END {IsNAN};

Open in new window

Delphi

Avatar of undefined
Last Comment
2266180

8/22/2022 - Mon