Fixed imaginary number check to use relative rather than absolute error.