in reply to Re^4: Negative zero? There's gotta be a sprintf that undoes that, right?
in thread Negative zero? There's gotta be a sprintf that undoes that, right?

Ironically, "-0.0" == 0 BUT triggers true in an ||... using that, however you CAN do...
$num = '-0.0000009'; $num = sprintf("%7.5f",$num); $num = $num == 0 ? '0.00000' : $num; print "$num\n";
I was hoping || would work, cuz then you could do
$num = sprintf("%7.5f",$num) || '0.00000';
but alas, no. The following works...
$num = sprintf("%7.5f",$num)+0 || '0.00000';
but you lose all trailing zeros, which works if you only want to round, but not for formatting, so probably doesn't help.

                - Ant
                - Some of my best work - (1 2 3)