Decimal floating point types support significant trailing zeroes to specify how much precision a value has. Trailing zeroes are relevant even for values of zero; for example, rounding 1.e-11dd to 10 places after the decimal point results in 0.e-10dd. The draft Technical Report N1241 for ISO/IEC TR 24732 doesn't specify this directly, but section 9.5 "Formatted input/output specifiers" shows expected output for five different representations of zero: 0, -0, 0.000000, 0e-07, and 0e+02. Currently GCC converts all decimal float literal values of zero to 0.DF, 0.DD, or 0.DL. I'm testing a patch to fix this but want a PR to record the issue.
Subject: Bug 35712 Author: janis Date: Thu Apr 3 23:49:35 2008 New Revision: 133881 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133881 Log: 2008-04-03 Janis Johnson <janis187@us.ibm.com> gcc/ PR c/35712 * dfp.c (decimal_from_decnumber): Retain trailing zeroes for decimal-float literal constant zero. testsuite/ PR c/35712 * gcc.dg/dfp/constants-zero.c: New test. Added: trunk/gcc/testsuite/gcc.dg/dfp/constants-zero.c Modified: trunk/gcc/ChangeLog trunk/gcc/dfp.c trunk/gcc/testsuite/ChangeLog
Janis, is this fixed so we can close this bugzilla?
Fixed in mainline. It's not a regression so the fix has not been applied to 4.3.
Subject: Bug 35712 Author: janis Date: Thu Sep 18 18:33:58 2008 New Revision: 140466 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=140466 Log: Backport from mainline: 2008-04-03 Janis Johnson <janis187@us.ibm.com> gcc/ PR c/35712 * dfp.c (decimal_from_decnumber): Retain trailing zeroes for decimal-float literal constant zero. testsuite/ PR c/35712 * gcc.dg/dfp/constants-zero.c: New test. Added: branches/gcc-4_3-branch/gcc/testsuite/gcc.dg/dfp/constants-zero.c Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/dfp.c branches/gcc-4_3-branch/gcc/testsuite/ChangeLog