You have the equation

y = mx + b

and m and b are known. A method to calculate A, B and C is to calculate 3 points on the line, say (x1,y1), (x2,y2) and (x3,y3). Then you have a set of three equations and three variables which can be solved.

A x1 + B y1 = C
A x2 + B y2 = C
A x3 + B y3 = C

This is quite easy. With some linear algebra or just isolating the variables you could calculate this.

Note that converting from decimal to fraction is not always possible. For example: pi. Though there is an algorithm which you can use to approximate decimals by fractions. In case of 2.5 it will be exact instead of an approximation.

* Constants *
N = number of iterations
PI = just pi, the decimal to be approximated

* Initialisation *
x [1] = PI
p [-1] = 0
p [0] = 1
q [-1] = 1
q [0] = 0

* The algorithm *
for n = 1 to N do
begin
d [n] = int (x [n])
p [n] = d [n] * p [n - 1] + p [n - 2]
q [n] = d [n] * q [n - 1] + q [n - 2]
x [n + 1] = 1 / (x [n] - d [n])
n = n + 1
end

x' = p [N] / q [N]

I have a lecture from university which explains the algorithm, but it's in Dutch. If you like to, I'll translate the explanation to English.