I increase a double by 0.1, 0.2 or 0.5 (depending on the setting) with every tick.
now i want to detect when the double value is an interger e.g 1,2,3,4,5,6 and so on.
how can i do this?
It is not advisable to try to do integer checks on Doubles that have been incremented by fractional decimal multiplication as Doubles, being a finite length binary representation of a number, cannot accurately represent decimal fractions so for example (n*10)/n may not result in the naively expected integer value, 10, but may result in something like 10.0000001 or 9.99999. Repeated operations may compound the effect. This is common to all binary computer architectures.
For simplicity I would recommend using Ints or Longs and scaling the multiplier values appropriately.
Except for short loop incrementers, I avoid using Int...
I use a Long, since we are blessed with much more system memory...
This is especially true when one uses a datetime to store as a var declared as int....
Just a hint, I have been bitten too often, spent too much time degugging - now I know better and understand why...