X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-3.5 required=5.0 tests=AWL,BAYES_40,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Message-ID: From: "Paul Edwards" To: Subject: gcc -ansi produces unexpected floating point result Date: Fri, 7 Dec 2012 18:04:44 +1100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com /* This program demonstrates a presumed bug in gcc 3.4.4 shipped with cygwin. If compiled with gcc -mno-cygwin -ansi, it prints: C:\devel\bwbasic>gcc -mno-cygwin -ansi zatest.c C:\devel\bwbasic>a 0.000000 2.000000 Instead of the expected 2.000000 for the first line, and undefined for the second line. Without -ansi it produces a good result. */ #include int main(void) { double x = 2.0; printf("%lf\n", x); printf("%f\n", x); return (0); } -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple