Factoring constant parts of division into a unique constant

23 Views Asked by At

I am writing a program for a slow micro controller. I have to calculate the equation below many times. The division and multiplication are very time consuming so I am looking to convert at least a part of the equation to a compile time constant. Can you please help me to figure out how to factor out the currently known constants? Here is the equation

In code:

((A / (var / B)) / C)

In math I beleive it should be: $$\frac{\frac{A}{\frac{var}{B}}}{C}$$

So, the only variable element here is the var and every thing else is numerical constants.

Is it possible to factor A, B and C as a constant D and at the end do something like:

ANSWER = var * D