[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] softfloat: Fix factor 2 error for scalbn on
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH v2] softfloat: Fix factor 2 error for scalbn on denormal inputs |
Date: |
Sun, 22 Dec 2013 08:41:12 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
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 <address@hidden>
> ---
> 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 <address@hidden>
r~