title: converting a float to decimal type in Python
body: <p>I have an array that grows with each iteration of a loop:</p>
  
  <pre><code>for i in range(100):
      frac[i] = some fraction between 0 and 1 with many decimal places
  </code></pre>
  
  <p>This all works fine. When I check the <strong>type(frac[i])</strong>, I am told that it is <strong>'numpy.float64'</strong>.</p>
  
  <p>For my code to be as precise as I need it to be, I need to use the decimal module and change each <strong>frac[i]</strong> to the decimal type.</p>
  
  <p>I updated my code:</p>
  
  <pre><code>for i in range(100):
      frac[i] = some fraction between 0 and 1 with many decimal places
  
      frac[i] = decimal.Decimal(frac[i])
  </code></pre>
  
  <p>But when I check the type, I am STILL told that <strong>frac[i]</strong> is <strong>'numpy.float64'</strong>.</p>
  
  <p>I have managed to change other variables to decimal in this way before, so I wonder if you could tell me why this doesn't seem to work.</p>
  
  <p>Thank you.</p>