title: Overflow / math range error for log or exp
body: <p>Line of code in question:</p>
  
  <pre><code>summing +=  yval * np.log(             sigmoid(np.dot(w.transpose(),xi.transpose()))) 
          +(1-yval)* np.log(max(0.001, 1-sigmoid(np.dot(w.transpose(),xi.transpose()))))
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>File "classify.py", line 67, in sigmoid
  return 1/(1+ math.exp(-gamma))
  OverflowError: math range error
  </code></pre>
  
  <p>The sigmoid function is just <code>1/(1+ math.exp(-gamma))</code>.</p>
  
  <p>I'm getting a math range error. Does anyone see why?</p>