Changing the training h rescales photon energy. Exact arithmetic here means exact results for the stated model inputs; measured inputs still carry uncertainty and significant-figure limits.
highlighted = computed this step
Smaller training h stays below the gap
Frequency stays at 3 hertz while h is 1 J/Hz. The photon energy is 3 joules, so accepted is 0 and excess is 0 joules.
E=hf=1⋅3=3J3J<Eg=6Jaccepted=0
Default training h reaches equality
Frequency stays at 3 hertz while h is 2 J/Hz. The photon energy is 6 joules, so accepted is 1 and excess is 0 joules.
E=hf=2⋅3=6J6J=Eg=6Jaccepted=1
Larger training h clears the gap
Frequency stays at 3 hertz while h is 3 J/Hz. The photon energy is 9 joules, so accepted is 1 and excess is 3 joules.