Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Fernando Nasser <fnasser@redhat.com>
To: Michael Snyder <msnyder@cygnus.com>
Cc: Jim Blandy <jimb@cygnus.com>, Eli Zaretskii <eliz@is.elta.co.il>,
	gdb-patches@sources.redhat.com
Subject: Re: RFA: don't try to compare IEEE NaN's
Date: Wed, 06 Jun 2001 11:04:00 -0000	[thread overview]
Message-ID: <3B1E6FFE.AF13DD36@redhat.com> (raw)
In-Reply-To: <3B1E6E7A.CEBC4116@cygnus.com>

Michael Snyder wrote:
> 
> Jim Blandy wrote:
> >
> > Eli Zaretskii <eliz@is.elta.co.il> writes:
> > > My assumption was that whoever wrote the test wanted to see that GDB
> > > doesn't lose bits due to all kinds of conversions that are going under
> > > the hood.  If that is true, you want to make sure the value you work with
> > > has the same bit pattern you wanted it to have.  If not, you don't really
> > > know what you are testing here; for example, imagine an (absurdly
> > > unrealistic) case that the compiler turns your literal constant into an
> > > all-zero bit pattern, or into a NaN.  Then you are back to square
> > > one.
> >
> > What you're saying is that, between this:
> >
> >         union {
> >           float f;
> >           char bytes[80];
> >         } u;
> >
> >         for (i = 0; i < 80; i++)
> >           u.bytes[i] = something interesting;
> >
> > and this:
> >
> >         u.f = 2.7182818284590452354;
> >
> > that you're more concerned that the latter will put a NaN in u.f than
> > the former.  When, in fact, the exact problem I'm trying to fix is
> > that someone's first shot at the former strategy produced a NaN.
> 
> "Someone" is me.  I of course knew that FFFFFFFF would be a NaN --
> I just didn't know that NaN could not be compared to itself on
> some platforms.  BTW, the reason for using a union as I did,
> rather than individual char, short, int etc. variables, was to
> make sure that the known bit pattern was actually larger than
> the type being tested -- so that we would know if, for instance,
> GDB was testing more bits than it should.

It makes sense.  It may still be possible to do this and still fix the
least significant bits to be a valid FP number.  It could be done before
calling the "float" and again before calling the "double" tests.

-- 
Fernando Nasser
Red Hat Canada Ltd.                     E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9


  reply	other threads:[~2001-06-06 11:04 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-06-05 20:40 Jim Blandy
2001-06-05 23:14 ` Eli Zaretskii
2001-06-06  6:54   ` Fernando Nasser
2001-06-06  7:27   ` Jim Blandy
2001-06-06  8:46     ` Eli Zaretskii
2001-06-06  9:15       ` Fernando Nasser
2001-06-06 11:38         ` Jim Blandy
2001-06-06 11:52           ` Fernando Nasser
2001-06-06 13:59             ` Michael Snyder
2001-06-06 23:20             ` Eli Zaretskii
2001-06-06 23:19           ` Eli Zaretskii
2001-06-06 10:37       ` Jim Blandy
2001-06-06 10:55         ` Michael Snyder
2001-06-06 11:04           ` Fernando Nasser [this message]
2001-06-06 11:15             ` Michael Snyder
2001-06-06 15:08           ` Jim Blandy
2001-06-06 23:19           ` Eli Zaretskii
2001-06-06 23:19         ` Eli Zaretskii
2001-06-07 10:38           ` Michael Snyder
2001-06-07 11:38             ` Eli Zaretskii
2001-06-06 13:17   ` Michael Meissner
2001-06-06 13:45     ` Fernando Nasser
2001-06-06 23:21     ` Eli Zaretskii
2001-06-06  6:45 ` Fernando Nasser

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3B1E6FFE.AF13DD36@redhat.com \
    --to=fnasser@redhat.com \
    --cc=eliz@is.elta.co.il \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jimb@cygnus.com \
    --cc=msnyder@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox