From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vum5i-0006SQ-DB for qemu-devel@nongnu.org; Sun, 22 Dec 2013 11:41:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vum5d-0003Rv-IN for qemu-devel@nongnu.org; Sun, 22 Dec 2013 11:41:22 -0500 Received: from mail-pa0-x22f.google.com ([2607:f8b0:400e:c03::22f]:34181) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vum5d-0003RW-B9 for qemu-devel@nongnu.org; Sun, 22 Dec 2013 11:41:17 -0500 Received: by mail-pa0-f47.google.com with SMTP id kq14so4497451pab.34 for ; Sun, 22 Dec 2013 08:41:16 -0800 (PST) Sender: Richard Henderson Message-ID: <52B71628.8090202@twiddle.net> Date: Sun, 22 Dec 2013 08:41:12 -0800 From: Richard Henderson MIME-Version: 1.0 References: <1387660099-22390-1-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1387660099-22390-1-git-send-email-peter.maydell@linaro.org> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2] softfloat: Fix factor 2 error for scalbn on denormal inputs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org Cc: patches@linaro.org On 12/21/2013 01:08 PM, Peter Maydell wrote: > If the input to float*_scalbn() is denormal then it represents > a number 0.[mantissabits] * 2^(1-exponentbias) (and the actual > exponent field is all zeroes). This means that when we convert > it to our unpacked encoding the unpacked exponent must be one > greater than for a normal number, which represents > 1.[mantissabits] * 2^(e-exponentbias) for an exponent field e. > > This meant we were giving answers too small by a factor of 2 for > all denormal inputs. > > Note that the float-to-int routines also have this behaviour > of not adjusting the exponent for denormals; however there it is > harmless because denormals will all convert to integer zero anyway. > > Signed-off-by: Peter Maydell > --- > Changes v1->v2: propagated fix to 80 bit and 128 bit float functions. > > These function names remind me of Ken Thompson's reply to a question > about what he'd do differently if he were redesigning UNIX: > "I'd spell creat with an e." > > fpu/softfloat.c | 29 +++++++++++++++++++++-------- > 1 file changed, 21 insertions(+), 8 deletions(-) Reviewed-by: Richard Henderson r~