Resolution
Could you post the ladder of how the calculation is being performed?
There are several methods that are used, but they all work on the principle of TOTAL = TOTAL + (RATE*TIME).
Usually these are calculated and stored in floating point registers. This is all well and good.
But even floating point registers, being 32-bit, only are good for about 8 to 10 significant figures. If your update TIME interval is small, then the RATE*TIME portion is also small. This is usually desirable, since the more frequent the data sampling (smaller time interval), the more accurate your calculation will be.
For normal batching applications, TOTAL starts at zero and never gets to more than a few orders of magnitude greater than RATE*TIME.
But as you keep totalizing without resetting TOTAL, the difference in the exponents between the two portions become greater and greater, and you get rounding errors.
If RATE*TIME = 0.012345 gal and TOTAL = 987,654.0 then the new TOTAL will be 987,654.012345. Except that this is too many digits to store in 21 bits (?) of the decimal part of a floating point register. So the REAL new TOTAL may be only 987,654.012. Losing that 0.000345 may not seem like much, but you are going to lose it every TIME interval.
It adds up.
The solution may be to have the running totalizer only go up to 10,000 gal. If it ever exceeds that, the "running totalizer" gets 10,000 subtracted from it, and a "tare" register gets 10,000 added. Your "day total" would then be the sum of the "running totalizer" plus the "tare". This way, you don't get the rounding error in your "running totalizer", but still maintain an accurate count.
Another way that you could be going wrong is if you use a self-resetting timer to do your TIME sampling.
TIME TIME
-----|/|-----------------( TON)
1 sec
This code has an interesting little quirk that for one whole PLC scan, the timer isn't timing. That may only be 5 msec every second, but again, it adds up. Better to use a more accurate timing method, like a program interrupt or the PLC's scan time (if available).