stupid stupid Javascript handling invalid math with NaNs ... I hate Javascript ... and I found oscillation the problem: condition comparing a NaN would always take the same path