In a 664 bit app, If I compare a floating point constant to a value obtained from StrToFloat() for the same "value" I get a different results. For example:
procedure foo;
const
d1 = 0.6694716
d3: double = 0.6694716
var
d2: double;
begin
d2 := StrToFloat('0.6694716');
if d1 = d2 then
beep;
if d1 = d3 then
beep;
if d2 = d3 then
beep;
end;
The d1 and d3 have a hex value of $B47339B4 while d2 has a hex value of $B47339B3. While they are "equal" for a comparison. They technically are not the same. From what I can tell, the constants d1 and d2 are wrong. Perhaps the compiler uses the FPU and this is due to rounding?
Short of making all my constants as strings and converting them at run time. Anyone know of a work around for this?