From: Toni Wilen Date: Fri, 10 Feb 2017 18:11:25 +0000 (+0200) Subject: SGLDIV/SGLMUL rounding fix. X-Git-Tag: 3500~103 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=8c3ee308affc13dd4bee5655a7f833f4cfc7b6a1;p=francis%2Fwinuae.git SGLDIV/SGLMUL rounding fix. --- diff --git a/softfloat/softfloat.cpp b/softfloat/softfloat.cpp index 781178c2..a71587f4 100644 --- a/softfloat/softfloat.cpp +++ b/softfloat/softfloat.cpp @@ -1071,16 +1071,11 @@ floatx80 roundAndPackFloatx80Sgl( flag zSign, int32_t zExp, uint64_t zSig0, uint roundBits = zSig0 & roundMask; if ( isTiny ) float_raise( float_flag_underflow, status ); if ( roundBits ) status->float_exception_flags |= float_flag_inexact; - if ( ( zSig0 & ~roundMask ) == 0 ) { - zSig0 = ( roundIncrement != roundMask ); - return packFloatx80( zSign, zExp, zSig0 ); - } zSig0 += roundIncrement; - roundIncrement = roundMask + 1; - if ( roundNearestEven && ( roundBits<<1 == roundIncrement ) ) { - roundMask |= roundIncrement; + if ( roundNearestEven && ( roundBits == roundIncrement ) ) { + roundMask |= roundIncrement<<1; } - zSig0 &= ~ roundMask; + zSig0 &= ~roundMask; return packFloatx80( zSign, zExp, zSig0 ); } }