Made equality test tolerant to numerical precision issues