First time here? Check out the FAQ!
answered 2017-02-11 02:14:12 -0600
apart from the obvious error, do not compare floats to 0 directly (this might go wrong in various ways).
rather compare against some epsilon, something like:
if (fabs(slope) < 0.00001f)