This might be a commonly known thing, but I wonder if there is any best practice of dealing with data spill-over in Delphi.
Say I have a variable Dt
that is assigned a value of 0.01
in code. When Delphi runs through it, the value of Dt
in debug mode is 0.0099999997765
, slightly off the actual value of 0.01
. Although the values are not significantly different, using Dt
in an iteration of 10000
steps will lead to it.
Any suggestion on how to force Dt
to 0.01
? Also, I am using Delphi 2003, so there are constrains on what I can do.
Dt:= 0.01 //Debug value = 0.0099999997765
.
for I=0 to 10000
temp := temp + Dt;
The issue is more prominent as temp
starts to spill, as well resulting in an answer that far off what is expected. Any suggestions?