how to find log in python without using the built-in function
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/13205078/calculating-logarithm-why-is-this-algorithm-not-efficient-and-how-to-make-it-m">Calculating logarithm, why is this algorithm not efficient, and how to make it more efficient?</a>  </p>
</blockquote>



<p>This code is supposed to return the power of b that equals x, or close to it but not larger. What is wrong with my code???</p>

<pre><code>def myLog(x, b):
    '''
    x: a positive integer
    b: a positive integer; b &gt;= 2

    returns: log_b(x), or, the logarithm of x relative to a base b.
    '''
    counter = 1
    while x &gt; b:
        if b &gt;= x:
            break
        else:
            b*=b
        counter += 1
    return counter
</code></pre>
