gcc -ansi produces unexpected floating point result

marco atzeri marco.atzeri@gmail.com
Fri Dec 7 07:26:00 GMT 2012


On 12/7/2012 8:04 AM, Paul Edwards wrote:
> /* This program demonstrates a presumed bug in gcc 3.4.4 shipped
>    with cygwin.

try gcc4, gcc3 is obsolete.

If still exist, please check if the bug is present also
on another platforms as it could be a general issue and not
a cygwin specific one.


>
>    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 <stdio.h>
>
> int main(void)
> {
>     double x = 2.0;
>
>     printf("%lf\n", x);
>     printf("%f\n", x);
>     return (0);
> }
>
>
Regards
Marco



--
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



More information about the Cygwin mailing list