Are you sure that's sprintf behaviour, or is there a limitation in the IEEE floating point representation of 1.5050 that has it leaning on the low side of 0.0050? That's the only explanation I can think of as to why sprintf would be broken like this.
Are you sure that's sprintf behaviour, or is there a limitation in the IEEE floating point representation of 1.5050 that has it leaning on the low side of 0.0050?
I'm not personally sure of any of this, no. As far as I know it could depend on the C compiler perl was compiled with, the C library it was compiled against, and the day of the week it was compiled. I was just asking how the other poster's explanation of sprintf's behavior differed from the desired rounding behavior.
On closer inspection, I think I see a difference I didn't notice before, though.