in reply to Stupid sprintf question - decimals

The fact that the digits near the end are changing on you should throw up a red flag in your mind. Consider the following case; the code

#!/usr/bin/perl use strict; use warnings; printf "%.2f%s", "4212412124124124.10623", "\n"; printf "%.2f%s", "12412124124124.10623", "\n";

outputs the result

4212412124124124.00 12412124124124.11

You are exceeding machine precision on your decimal. See What Every Computer Scientist Should Know About Floating-Point Arithmetic for background.