in reply to Rounding error?

This is expected. sprintf does an unbiased rounding, so .5 not always round up.

"C is doing the exact opposite"

Your Perl simply calls the underlying c sprintf. Instead of saying C is doing the opposite, you should just say "my c follows slightly different rule than the c used to compile my Perl."