EGCS bug when passing float NaN?

Mumit Khan khan@xraylith.wisc.EDU
Mon May 31 21:10:00 GMT 1999

"Roger L Gates" <> writes:
> The attached code gave different results than I expected
> using CYGWIN B20.1 (gcc --version == egcs-2.91.57):
>   global: NaN = 7f99999a
>   passed: NaN = 7fd9999a
> The bit pattern is different inside the subroutine!
> I got similar results compiling with -mno-cygwin:
>   global: 1.#QNAN0 = 7f99999a
>   passed: 1.#QNAN0 = 7fd9999a
>    (void) printf("global: %f = %lx\n", global.f, global.l);
>    (void) printf("passed: %f = %lx\n", passed.f, passed.l);

I don't believe this is a bug. The printf family of routines 
typically print out "NaN" when the format specified is float/double 
(most implementations compare the bit pattern to the NAN bit sequence 
or call isnan). When format is something else, it just prints the bit 
pattern directly.

I need to look up the IEEE fp docs for chapter and verse. Anybody
with a copy handy?

You may want to post this to one of the standards newsgroups and
see what folks say.


Want to unsubscribe from this list?
Send a message to

More information about the Cygwin mailing list