in reply to [s]printf %d oddity

In addition to the above answers, note that some "simple" decimal floats cannot be represented by binary floats, which are used by most languages, including perl. You should always expect some small errors that you can usually work around by using sprintf("%xx.xxf"):

http://support.microsoft.com/kb/q42980/
http://www-106.ibm.com/developerworks/java/library/j-jtp0114/
edit: and perldoc -q decimal

Updated for clarity, this part added:

Usually, the standard float -> string conversion as used by print() handles these inaccuracies fairly well, but printf("%d") does a "hard" truncate, as you can see here:

> perl -e 'print (8.78 * 100 ) 878 > perl -e 'printf("%d", (8.78 * 100 ))' 877
This is documented in perlnumber, but the implications can be hard to predict (and hard to debug, since what is printed is not necissarily the same as what is in the number).