[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 1/5] softfloat: fix float{32, 64}_muladd options
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 1/5] softfloat: fix float{32, 64}_muladd options |
Date: |
Sun, 9 Sep 2012 11:25:22 +0100 |
On 9 September 2012 10:24, Aurelien Jarno <address@hidden> wrote:
> My idea was that negating both the product and c is equivalent to
> negating the result, so there is no need to allow all of them
> independent.
This is the kind of statement about floating point arithmetic that
sounds plausible but turns out to be untrue for some odd corner
case. Consider a = +0, b = +0, c = -0.
If we're negating the result, then:
-((a * b) + c) = -((+0 * +0) + -0)
= -(+0 + -0)
= -(+0)
= -0
(assuming round to nearest; rounding mode affects the answer
to '+0 + -0')
If we negate both product and c:
(-(a * b) + -c) = (-(+0 * +0) + -(-0))
= (-(+0) + +0)
= (-0 + +0)
= +0
so the two calculations give us zeros of different sign.
-- PMM
- Re: [Qemu-devel] [PATCH 4/5] target-ppc: use the softfloat float32_muladd function, (continued)
- [Qemu-devel] [PATCH 3/5] target-ppc: use the softfloat min/max functions, Aurelien Jarno, 2012/09/08
- [Qemu-devel] [PATCH 5/5] target-ppc: get rid of the HANDLE_NAN{1, 2, 3} macros, Aurelien Jarno, 2012/09/08
- [Qemu-devel] [PATCH 2/5] target-ppc: simplify NaN propagation for vector functions, Aurelien Jarno, 2012/09/08
- Re: [Qemu-devel] [PATCH 1/5] softfloat: fix float{32, 64}_muladd options, Max Filippov, 2012/09/08