I am finding myself involved in projects that require math operations, but I am not yet accustomed to working with integer math.
For example, I want to compute the value of a resistor R2 in a voltage divider setup. The value is given by:
R2 = R1 / ((Vin/Vout)-1)
Where R1 is the resistor connected to +Vin, R2 is the unknown resistor connected to GND, Vin = 5V= 1023 in 10bit ADC resolution and Vout = ADC reading
What would be the best way to compute R2 with the least loss of precision?
(Assume that the value of R1 is optimally chosen)
BTW, I don't want to use a floating point math library because of the overhead (I need the extra space)
Bookmarks