title: Python vs Javascript floating point arithmetic giving very different answers. What am I doing wrong?
body: <p><a href="http://code.google.com/p/pyglicko/source/browse/glicko.py" rel="noreferrer">Python version</a> | <a href="https://github.com/austinyun/JS-Glicko/blob/master/glicko.js" rel="noreferrer">Javascript version</a> | <a href="http://www.glicko.net/glicko/glicko.pdf" rel="noreferrer">Whitepaper</a></p>
  
  <p>So, I'm working on a website to calculate Glicko ratings for two player games. It involves a lot of floating point arithmetic (square roots, exponents, division, all the nasty stuff) and I for some reason am getting a completely different answer from the Python implementation of the algorithm I translated line-for-line. The Python version is giving basically the expected answer for the example found in the original whitepaper describing the algorithm, but the Javascript version is quite a bit off.</p>
  
  <p>Have I made an error in translation or is Javascript's floating point math just less accurate?</p>
  
  <pre><code>Expected answer: [1464, 151.4]
  Python answer: [1462, 155.5]
  Javascript answer: [1470.8, 89.7]
  </code></pre>
  
  <p>So the rating calculation isn't THAT bad, being 99.6% accurate, but the variance is off by 2/3!</p>
  
  <p>Edit: People have pointed out that the default value of RD in the Pyglicko version is 200. This is a case of the original implementer leaving in test code I believe, as the test case is done on a person with an RD of 200, but clearly default is supposed to be 350. I did, however, specify 200 in my test case in Javascript, so that is not the issue here.</p>
  
  <p>Edit: Changed the algorithm to use map/reduce. Rating is less accurate, variance is more accurate, both for no discernible reason. Wallbanging commence.</p>