There are many centuries of engineering behind this. I went to the Museum of Horology in Austria. It has examples of the first mechanical clocks, up to today's timepieces. It is fascinating looking at the giant, wrought-iron town clocks that kept shitty time and bent and rusted, and seeing different parts of the clock evolve over the years, especially as engineering & metallurgy improved.
The section on power really understates the complexity. Throttling didn't appear until the mid-90's as a coarse clock gating chipwide. Voltage/frequency scaling appeared a few years later (gradual P-state transitions). Then power control units monitored key activity signals and could not only scale the voltage, but estimate power and target specific blocks (e.g., turning off L1 D$).
There are some more details in there but that's the main gist. The power control unit is its own operating system!
Also, I wouldn't use epsilon, because that is a very small number and is related to representation of numbers. I would instead use a larger "tolerance" value, in `if |a-b| < tol ...` because that indicates the expected accuracy of your algorithm (unless you're really working with 1e-80 tolerance?). But TFA explains that.
But back to point (a) is that not reasonable? (If not, I've got some code to change... :)
https://www.watchtime.com/featured/watch-spotting-at-the-vie...