I've found an issue where the map scale returned by function map.getScale() is incorrect. Take a look at the screenshot of debug code below:

You can see that I set the scale to a round number of 10,000,000, then in the next line I read the scale back from the map. The scale returned is 9,633,193.199... Any idea why this is happening?