So, here’s the drill. In CS, we frequently need to check a variable compared to a predefined threshold.
Typical uses include checking the light level in a room and controlling the lights when it exceeds or goes below a certain threshold (the same can be done with temperature, essentially like a thermostat), checking the negative votes (vote-downs) for a post and removing it if it exceeds a threshold, e.t.c.
That’s usually easy to do programatically:
if(downvotes > VOTES_THRESHOLD)
However, when you work with fluctuating variables, it’s harder to do a proper check. This is a common problem with sensor values, because they tend to …