Okay, let's look at this another way.
Your analog sensor gives you a value of 0-255
Your motor takes a value of 0-255
So, why are you using a float?
At the worst case, you could use a look up table.
You have your complicated formula you want to use. Use your formula to make an array. Then, you just need:
Code:
myvalue = LookUpTable[GetAnalogValue(....)];
Make sense?
Or, you can forget about inches, and deal with everything in the domain of 0-255, whatever units they happen to be
