title: numpy linalg.lstsq with big values
body: <p>I'm using linalg.lstsq to build a regression line inside a function like this:</p>
  
  <pre><code>def lsreg(x, y):
      if not isinstance(x, np.ndarray):
          x = np.array(x)
      if not isinstance(y, np.ndarray):
          y = np.array(y)
      A = np.array([x, np.ones(len(x))])
      ret = np.linalg.lstsq(A.T, y)
      return ret[0]
  </code></pre>
  
  <p>and calling it like this:</p>
  
  <pre><code>x = np.array([10000001, 10000002, 10000003])
  y = np.array([3.0, 4.0, 5.0])
  regress = lsreg(x, y)
  fit = regress[0]*x + regress[1]
  print fit
  </code></pre>
  
  <p>and the output y get is:</p>
  
  <pre><code>[ 3.  4.  5.]
  </code></pre>
  
  <p>So far, so good. Now, if I change x like this:</p>
  
  <pre><code>x = np.array([100000001, 100000002, 100000003])
  y = np.array([3.0, 4.0, 5.0])
  regress = lsreg(x, y)
  fit = regress[0]*x + regress[1]
  print fit
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>[ 3.99999997  4.00000001  4.00000005]
  </code></pre>
  
  <p>instead of something close to 3, 4 and 5.</p>
  
  <p>Any clue on what is going on ?</p>