[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 07/20] softfloat: fix float*_scalnb() corner cas
From: |
Aurelien Jarno |
Subject: |
Re: [Qemu-devel] [PATCH 07/20] softfloat: fix float*_scalnb() corner cases |
Date: |
Wed, 20 Apr 2011 11:21:04 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
On Tue, Apr 19, 2011 at 12:57:23PM +0100, Peter Maydell wrote:
> On 18 April 2011 21:59, Aurelien Jarno <address@hidden> 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
address@hidden http://www.aurel32.net
- [Qemu-devel] [PATCH 01/20] softfloat: fix floatx80 handling of NaN, (continued)
- [Qemu-devel] [PATCH 01/20] softfloat: fix floatx80 handling of NaN, Aurelien Jarno, 2011/04/18
- [Qemu-devel] [PATCH 16/20] target-i386: add CPU86_LDouble <-> double conversion functions, Aurelien Jarno, 2011/04/18
- [Qemu-devel] [PATCH 04/20] softfloat: add pi constants, Aurelien Jarno, 2011/04/18
- [Qemu-devel] [PATCH 07/20] softfloat: fix float*_scalnb() corner cases, Aurelien Jarno, 2011/04/18
- [Qemu-devel] [PATCH 12/20] target-i386: fix helper_fxtract() wrt softfloat, Aurelien Jarno, 2011/04/18
- [Qemu-devel] [PATCH 06/20] softfloat: add floatx80_compare*() functions, Aurelien Jarno, 2011/04/18
- [Qemu-devel] [PATCH 08/20] softfloat-native: fix float*_scalbn() functions, Aurelien Jarno, 2011/04/18
- [Qemu-devel] [PATCH 17/20] target-i386: fix logarithmic and trigonometric helpers wrt softfloat, Aurelien Jarno, 2011/04/18
- [Qemu-devel] [PATCH 13/20] target-i386: fix helper_fdiv() wrt softfloat, Aurelien Jarno, 2011/04/18