Be sure that the difference of y-coordinates is in the numerator and the difference of the x-coordinates is in the denominator. Also, be sure to use the coordinates in the same "order" in the numerator and denominator. That is, if the numerator is y-coordinate of first point minus y-coordinate of second point, then the denominator should be the x-coordinate of the first point minus the x-coordinate of the second point.