-0.00
Jim Wilson
wilson@specifixinc.com
Tue Jan 6 19:43:00 GMT 2004
Mohammad Hossein Bateni wrote:
> it writes: -0.00 instead of 0.00
> double a = -0.0001;
> printf("%0.02lf\n", a);
See http://gcc.gnu.org/bugs.html for info on reporting bugs.
This is a C library issue, not a compiler issue. Since you gave no info
about the target, I can not comment further. You could try reporting
this to whoever maintains the C library you are using. However, the
behaviour seems reasonable to me. printf doesn't do any arithmetic on
the value, it just prints how many digits you asked for. The value is
negative, and you only asked for two sigificant digits, so -0.00 is what
you get.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
More information about the Gcc-bugs
mailing list