Module Name: src Committed By: martin Date: Fri Nov 22 17:04:24 UTC 2013
Modified Files: src/lib/libc/softfloat/bits64: softfloat.c Log Message: Fix a cast from the lint cleanup that made small exponents (i.e. values < 1) sign extend wrong and overflow, causing an underflow in all 128 bit sqrt calculations. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/lib/libc/softfloat/bits64/softfloat.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libc/softfloat/bits64/softfloat.c diff -u src/lib/libc/softfloat/bits64/softfloat.c:1.12 src/lib/libc/softfloat/bits64/softfloat.c:1.13 --- src/lib/libc/softfloat/bits64/softfloat.c:1.12 Thu Jan 10 08:16:11 2013 +++ src/lib/libc/softfloat/bits64/softfloat.c Fri Nov 22 17:04:24 2013 @@ -1,4 +1,4 @@ -/* $NetBSD: softfloat.c,v 1.12 2013/01/10 08:16:11 matt Exp $ */ +/* $NetBSD: softfloat.c,v 1.13 2013/11/22 17:04:24 martin Exp $ */ /* * This version hacked for use with gcc -msoft-float by bjh21. @@ -46,7 +46,7 @@ this code that are retained. #include <sys/cdefs.h> #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: softfloat.c,v 1.12 2013/01/10 08:16:11 matt Exp $"); +__RCSID("$NetBSD: softfloat.c,v 1.13 2013/11/22 17:04:24 martin Exp $"); #endif /* LIBC_SCCS and not lint */ #ifdef SOFTFLOAT_FOR_GCC @@ -5261,7 +5261,7 @@ float128 float128_sqrt( float128 a ) if ( ( aSig0 | aSig1 ) == 0 ) return packFloat128( 0, 0, 0, 0 ); normalizeFloat128Subnormal( aSig0, aSig1, &aExp, &aSig0, &aSig1 ); } - zExp = ( (unsigned int)(aExp - 0x3FFF) >> 1) + 0x3FFE; + zExp = (int32) ( (aExp - 0x3FFF) >> 1) + 0x3FFE; aSig0 |= LIT64( 0x0001000000000000 ); zSig0 = estimateSqrt32((int16)aExp, (bits32)(aSig0>>17)); shortShift128Left( aSig0, aSig1, 13 - ( aExp & 1 ), &aSig0, &aSig1 );