title: Most efficient way to find order of magnitude of float in python
body: <p>I have to make some iterative calculation and I need to find the order of magnitude  (that bit after e in scientific notation) of my float number every time.
  Currently I'm doing that with a loop, but it's eating up a lot of time and my calculations take forever.</p>
  
  <pre><code>while n&lt;1.0:
      order=order-1
      n=n*10
  </code></pre>
  
  <p>Is there some function that I can use to just swiftly extract this info from the way python stores float numbers? 
  I was taught that floating point numbers store the value and the exponent separately.</p>
  
  <p>Edit: it's not a duplicate because I'm asking for the most efficient method. The one proposed with the logarithm is actually three times slower than the loop.</p>