in reply to Re: Why is Zero not 0?
in thread Why is Zero not 0?

IIRC the -0.00 representation happens when you're using sprintf("%0.2f",$some_number_very_slighty_less_than_zero). The last two digits happen because they were specified in the format string. the minus sign is supposedly because that's how the C stdio lib does that.

update:

#include "stdio.h" int main() { printf("%0.2f\n",-0.000000000000000000000000001); }
$ ./a.out -0.00

Replies are listed 'Best First'.
Re^3: Why is Zero not 0?
by syphilis (Archbishop) on Feb 03, 2008 at 03:57 UTC
    I think that, so long as the number is less than zero && the number rounds to zero, then we get a leading "-0". Hence:
    C:\C>perl -e "printf \"%0.2f\", -0.0049" -0.00 C:\C>perl -e "printf \"%.0f\", -0.499" -0
    Cheers,
    Rob