Java too. This exact issue corrupted App Engine Datastore indices occasionally early on. None of us managed to figure out out until Alfred Fuller came along and spent something like a month full time on it. Turned out to be negative vs positive modulo. 🤦
#