Floating point math is IEEE 754 in pretty much all cases, so you should see this result in most languages. `math.log(1000, 10)` gives the same result because it's implemented using natural logs internally as it is in most languages.
In this case, there's only about six boundary cases to consider so you can just manually verify it works as expected.