Got an Arduino to read and register gasmeter etc. Unfortunately our gasmeter (1987) doesn't have mirror on digit so I have put a CNY70 IR sensor on and after reading values I parse these to identify when the 2nd digit turns over.

When I test the code occasionally I get 2 additions, in 1 loop, and I don't understand. Could it be because I am using float as type??

if (currentReading >= pHigh || currentReading <= pLow) { <snip> delay(4000); currentReading = analogRead(sensorPin); } previousReading=currentReading;I don't understand this. If the current reading differed from the previous reading by a significant amount, do some stuff, wait 4 seconds, take another reading and store that as the previous reading.

0.01 is not a value that can easily be represented in binary. I think that if you print the value to more than 2 decimal places, you'll see the problem.