From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 415 invoked by alias); 18 Oct 2011 09:34:17 -0000 Received: (qmail 32752 invoked by uid 22791); 18 Oct 2011 09:34:16 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,TW_GC,TW_GX X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 18 Oct 2011 09:33:58 +0000 From: "momchil at xaxo dot eu" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/50773] New: float values are printed with greater precision than the float data type has when given as an argument to printf() Date: Tue, 18 Oct 2011 09:34:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: momchil at xaxo dot eu X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg01757.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50773 Bug #: 50773 Summary: float values are printed with greater precision than the float data type has when given as an argument to printf() Classification: Unclassified Product: gcc Version: 4.5.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: momchil@xaxo.eu test case: #include int main(int argc, char *argv[]) { float a = 268517138.f; printf(" 268517138.f = %f\t%f\n", 268517138.f, a); return 0; } output when compiling with -fexcess-precision=standard: 268517138.f = 268517138.000000 268517152.000000 output when compiling with -fexcess-precision=fast: 268517138.f = 268517152.000000 268517152.000000 reference thread: http://gcc.gnu.org/ml/gcc-help/2011-10/msg00120.html gcc versions tested: Using built-in specs. COLLECT_GCC=gcc46 COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc46/gcc/i386-portbld-freebsd8.1/4.6.0/lto-wrapper Target: i386-portbld-freebsd8.1 Configured with: ./../gcc-4.6-20110101/configure --enable-lto=no --disable-nls --libdir=/usr/local/lib/gcc46 --libexecdir=/usr/local/libexec/gcc46 --program-suffix=46 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc46/include/c++/ --with-ld=/usr/local/bin/ld --with-libiconv-prefix=/usr/local --with-system-zlib --disable-rpath --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc46 --build=i386-portbld-freebsd8.1 Thread model: posix gcc version 4.6.0 20110101 (experimental) (GCC) Using built-in specs. COLLECT_GCC=gcc45 COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc45/gcc/i386-portbld-freebsd8.2/4.5.3/lto-wrapper Target: i386-portbld-freebsd8.2 Configured with: ./../gcc-4.5-20110310/configure --enable-lto=yes --with-libelf=/usr/local --disable-nls --libdir=/usr/local/lib/gcc45 --libexecdir=/usr/local/libexec/gcc45 --program-suffix=45 --with-as=/usr/local/bin/as --with-gmp=/usr/local --with-gxx-include-dir=/usr/local/lib/gcc45/include/c++/ --with-ld=/usr/local/bin/ld --with-libiconv-prefix=/usr/local --with-system-zlib --disable-rpath --enable-libgcj --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc45 --build=i386-portbld-freebsd8.2 Thread model: posix gcc version 4.5.3 20110310 (prerelease) (GCC)