Perturbatio #1 at a guess, and without looking at the code, it's probably a floating point precision issue. You could check to see if it's close to 1.0 and if so, just set it.