What i’m trying to do is compare two variables. Basically it is from a double
computation, and the values appear to be the same, but the computer doesn’t think they are.
public Line(double x, double y, double slope)
{
this.slope=0;
this.slope = slope;
this.yIntercept = y-x*slope;
this.isVertical = false;
}
...
(this.slope == other.slope) // when these are equal, this is returning false
this.slope
and other.slope
are both supposed to be equal. However, the computer is saying that the variables are not equal. When i check debug, these are the variables and their values.
this.slope = 1.0, other.slope = 1.0
essentially they are the same value, but my computer is deciding that they are not.
I tried adding tolerance of 0.001 and such, but the computer is still saying the two variables are not equal.
I think this could have been a bit flip but not entirely sure what happened here.