title: Defining precision of floating point number in Python
body: <p>I have some python code here</p>
  
  <p>Code: </p>
  
  <pre><code> t = 1
   xt = array([ -1.,-1. ])
  
   xt[0] = theta[0][0]* P_all_States[t-1][0] + theta[1][0]*P_all_States[t-1][1]
  
   xt[1] = theta[0][1]* P_all_States[t-1][0] + theta[1][1]*P_all_States[t-1][1]
  
   P_all_States[t][0] = xt[0]
   P_all_States[t][1] = xt[1]
   print ("Added probability distribution for time t = " + str(t) + " to P_all_States")
   print P_all_States
  </code></pre>
  
  <p>Output:</p>
  
  <blockquote>
    <blockquote>
      <p>Added probability distribution for time t = 1 to P_all_States
      [[0.6, 0.4], [0.62000000000000011, 0.38000000000000006], [-1.0, -1.0], [-1.0, -1.0], [-1.0, -1.0], [-1.0, -1.0]]</p>
    </blockquote>
  </blockquote>
  
  <p>How can I get the floating point numbers to round to 2 sigficant digits?</p>
  
  <p>These are all floats, so Im not looking to convert these to strings, I want them to remain as floats</p>
  
  <p>Thanks</p>