qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH] softfloat: fix floatx80_is_{quiet, signaling}_nan()
Date: Thu, 13 Jan 2011 08:31:42 +0100	[thread overview]
Message-ID: <20110113073142.GA25117@ohm.aurel32.net> (raw)
In-Reply-To: <AANLkTimxM2UoeCpwpzhwY+R8ze-DXxDddY9wA_ct_H+-@mail.gmail.com>

On Wed, Jan 12, 2011 at 03:05:10PM -0600, Peter Maydell wrote:
> On 12 January 2011 13:59, Aurelien Jarno <aurelien@aurel32.net> wrote:
> 
> > @@ -494,7 +495,8 @@ int floatx80_is_quiet_nan( floatx80 a )
> >  int floatx80_is_signaling_nan( floatx80 a )
> >  {
> >  #if SNAN_BIT_IS_ONE
> > -    return ( ( a.high & 0x7FFF ) == 0x7FFF ) && (bits64) ( a.low<<1 );
> > +    return ( ( a.high & 0x7FFF ) == 0x7FFF )
> > +        && (LIT64( 0x8000000000000000 ) >= ((bits64) ( a.low<<1 )));
> >  #else
> >     bits64 aLow;
> 
> If a is {0x7ffff,0} (ie +inf) this will return true, which is wrong.
> Do you want "<=" instead?

Correct, I swapped the operands at the last minute to match the other
functions, but without changing the sign.

> Actually, will
>   return ((a.high & 0x7fff) == 0x7fff) && (a.low >= LIT64(0x4000000000000000));
> do? Untested but I think it will do the right thing. I'm not sure

The explicit bit might be one for a NaN, so you should filter it first.

> why this code has those bit64 casts, incidentally, since a.low is
> already a uint64_t.

Don't know either, but as they were already there, I left them.

> Also, maybe we should have a comment somewhere explaining
> why this is different from the other NaN functions (ie that the
> x80 format has an explicit bit and the others don't) ?
> 

Good idea, will do.

-- 
Aurelien Jarno                          GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

  reply	other threads:[~2011-01-13  7:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-12 19:59 [Qemu-devel] [PATCH] softfloat: fix floatx80_is_{quiet, signaling}_nan() Aurelien Jarno
2011-01-12 21:05 ` [Qemu-devel] " Peter Maydell
2011-01-13  7:31   ` Aurelien Jarno [this message]
2011-01-13 12:15     ` Peter Maydell

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=20110113073142.GA25117@ohm.aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).