Used safer method to find the real root of xi. Langtangen taught us not to compare floats with '=='.