A nearby frequency is rejected when the equality fails. Exact arithmetic here means exact results for the stated model inputs; measured inputs still carry uncertainty and significant-figure limits.
highlighted = computed this step
A nearby frequency is still checked exactly
With frequency 4 hertz, the photon energy is 4 joules.
E=hf=1⋅4=4J
The matched bit records the failed equality
The gap remains 5 joules, so the matched bit is 0.