From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:37558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCU5S-0003u1-TK for qemu-devel@nongnu.org; Wed, 20 Apr 2011 05:52:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QCU5R-0001MC-R6 for qemu-devel@nongnu.org; Wed, 20 Apr 2011 05:52:42 -0400 Received: from hall.aurel32.net ([88.191.126.93]:41590) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCU5R-0001Ls-Id for qemu-devel@nongnu.org; Wed, 20 Apr 2011 05:52:41 -0400 Date: Wed, 20 Apr 2011 11:21:04 +0200 From: Aurelien Jarno Message-ID: <20110420092104.GD6388@volta.aurel32.net> References: <1303160412-8107-1-git-send-email-aurelien@aurel32.net> <1303160412-8107-8-git-send-email-aurelien@aurel32.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Subject: Re: [Qemu-devel] [PATCH 07/20] softfloat: fix float*_scalnb() corner cases List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel@nongnu.org On Tue, Apr 19, 2011 at 12:57:23PM +0100, Peter Maydell wrote: > On 18 April 2011 21:59, Aurelien Jarno wrote: > > > @@ -6349,6 +6352,12 @@ float32 float32_scalbn( float32 a, int n STATUS_PARAM ) > >     else if ( aSig == 0 ) > >         return a; > > > > +    if (n > 0x80) { > > +        n = 0x80; > > +    } else if (n < -0x80) { > > +        n = -0x80; > > +    } > > + > >     aExp += n - 1; > >     aSig <<= 7; > >     return normalizeRoundAndPackFloat32( aSign, aExp, aSig STATUS_VAR ); > > I don't think your if() condition is right here. Consider the > float32 00800000 (1.0 * 2 ^ -126 ; the smallest possible normalised > number); you can multiply this by, say, 2^253, without overflowing > to infinity. However your if() here means we'll incorrectly > compute the result of multiplying by 2^128 instead. s/0x80/0x200/ > should work. > Correct, will be fixed in the next version. -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net