Yeah that seems like a serious flaw to me too. On my Python:
>>> math.log(1000)/math.log(10)
2.9999999999999996
>>> int(math.log(1000)/math.log(10))
2
But I don't know about the guarantees provided in the JavaScript standard (or more importantly those offered by actual browsers).