This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project. See the Cygwin home page for more information.
Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: EGCS bug when passing float NaN?


"Roger L Gates" <rgates@chandlerevans.com> 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.

Regards,
Mumit


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com