Sadly, in java, due to inaccuracies of double divisions, log10(1000) == 2. This is a bit of a bummer - basic algorithms completely fail when you can’t even get log( 1000 ) to equal 3 :(.
(NB: it actually comes out as 2.999999999999999996 - which, obviously, is wrong, however you look at it)
In the past, I’ve written entire classes to get around Java’s crapness in this regards (yes, I know they have finally added log10 to java 5, thank god, but I still use 1.4 for everything), and it looks like I’m about to have to do so again, using hand-tweakable epsilons to enforce things like 2.999… == 3.
But, surely there’s a better way? What do you use?