@DonStauffer While I was falling asleep an idea occurred to me, so when I woke up in the middle of the night I tried something.
Operating on the bizarre assumption that the Y coordinate representation was slightly different when the location was between probe points (even when the Y coordinate didn't change, in reality and in appearance), I added 0.0001 to the values inside the floor function and the first argument to the mod function when dealing with float values. That seems to have fixed the problem, or maybe masked it (I'm not sure).
I'm aware of problems with programming using floating point, but it hadn't previously occurred to me that the representation of a particular value could be different at different times.