I've also found this to be an excellent rule of thumb: If you're computing with floating point numbers, and you're worried about division-by-zero, then you'd better be *just as worried* by *approximations to zero*. I.e., any floating point code that is subject to division by zero is unstable w.r.t. very small numbers as well. Time to re-analyze your code to see why numbers this small are being used as divisors. Ditto for any *singularity*; don't just check for it -- *keep far away from it*. Before I learned about quaternions, I was constantly running into the digital equivalent of "gimbel lock", which can exhibit itself as numerical instability. https://en.wikipedia.org/wiki/Gimbal_lock At 08:07 AM 12/21/2015, Veit Elser wrote:
I think I did the right thing by pointing out to the intern that the code surely suffers from more serious problems if that check fails with any regularity!