...and we the users (or maintenance programmers) write the pertinent definition of "incorrect". Software and hardware might execute flawlessly the exact steps proscribed by a set of exhaustive written policies. If that is the case, good jorb and a round of gold star stickers to everyone responsible. Still, the algorithm is incorrect each time it produces a different result than we think it should.
The way to cope is to plan ahead for inevitable incorrectness. As much as is reasonable, assumptions should be flexible. Options should be open-ended. Overrides should be available; users should be advised and protected from mistakes, but some users have their own good reasons to request something "incorrect".
A perfect algorithm will be incorrect. More poetically, a perfect algorithm is too good for this imperfect world.