Trying to scale tikzpicture to the textwidth, I got undesired effect of drawing rounded corners when parameterized hvh-path (horizontal-vertical-horizontal) eventually apperaed to be simple straight line. Before scaline everything was fine, because I checked if points lie on horizontal line (by the way, I find the presence of such corners in this case be a buggy behaviour of path drawing algorithm). I tried applying \pgfmathapproxequalto but it didn't help. After spending some time playing with different functions, I've ended up with the following workaround: \pgfmathparse{abs(\y1 - \y2) <= 0.01}. So it would be great for the user to be able to define how precise comparision he wishes.
For details see https://github.com/pgf-tikz/pgf/issues/582