title: Compute logarithmic expression without floating point arithmetics or log
body: <p>I need to compute the mathematical expression <code>floor(ln(u)/ln(1-p))</code> for <code>0 &lt; u &lt; 1</code> and <code>0 &lt; p &lt; 1</code> in <strong>C</strong> on an embedded processor with <em>no floating point arithmetics</em> and no <code>ln</code> function. The result is a positive integer. I know about the limit cases (p=0), I'll deal with them later...</p>
  
  <p>I imagine that the solution involves having <code>u</code> and <code>p</code> range over <code>0..UINT16_MAX</code>, and appeal to a lookup table for the logarithm, but I cannot figure out how exactly: what does the lookup table map to?</p>
  
  <p>The result needs not be 100% exact, approximations are OK.</p>
  
  <p>Thanks!</p>