On Wed, Sep 30, 2009 at 21:05, Michael B. Brutman
<mbbrutman-cctalk at brutman.com> wrote:
I need to figure out how to do this:
?float elapsed = ticks * 0.85;
using purely integer operations.
There's a gazillion ways to do it; first question would be, what
precision do you need? What is the range of ticks?
If the range of ticks is small (8 bits or so) see if a lookup table
can be fit into RAM; otherwise, figure out the precision you need and
the size of storage for an intermediate value, then calculate
(ticks*x)>>n, where x/(2^n) approximates 0.85.
Joe.
--
Joachim Thiemann ::
http://www.tsp.ece.mcgill.ca/~jthiem