Representing 2D line as two variables, all cases 
Is it possible to represent a line in the general case using only two variables (namely floats or doubles)? By this I mean being able to convert a line into those two variables and successfully converting them back without loss of data or the algorithm failing for specific cases.

I know it can be done with three, since any line can be represented as the coefficients in Ax + By = C, but I can't represent a line using two using the coefficients in Ax + By = 1, since this representation produces infinite values for A or B if the line passes through the origin, and I can't use the coefficients m and b in y = mx+b since m becomes infinite for vertical lines.

Yes, it is possible to represent any line with only two variables:
p is the length of normal from coordinate origin to line
Theta is angle between OX-axis and direction of normal.
Equation:   
x*Cos(Θ) + y*Sin(Θ) - p = 0


To transform canonical equation of line to normal form:
A*x+B*y+C=0
D=Sqrt(A^2+B^2)
Sgn = Sign(C) (-1,0,+1)
p=Sign*C/D  //always positive
Cos(Theta)=Sgn*A/D 
Sin(Theta)=Sgn*B/D 

or 
p=Abs(C)/D
Theta=atan2(B,A) (clamped to range [0..Pi))

another relation:
Fi = Theta - Pi/2

where tg(Fi)=k in equation y=kx+b
