found two bugs. one is incorrect comparison of floating point numbers