[COMMITTED] [PATCH] powerpc: Fix incorrect results for pow when using FMA
Adhemerval Zanella
azanella@linux.vnet.ibm.com
Tue Mar 10 18:46:00 GMT 2015
On 10-03-2015 14:55, Joseph Myers wrote:
> On Tue, 10 Mar 2015, Adhemerval Zanella wrote:
>
>> This patch adds no FMA generation for e_pow to avoid precision issues
>> for powerpc. This fixes BZ#18104.
> I've added the testcase from the bug (as I understand it) to the
> testsuite; tested on x86_64 and x86. Could you confirm that this new test
> shows large errors before your patch?
Yes, *without* the patch I see:
testing double (without inline functions)
Failure: Test: pow (0x2.fa3414de4p+680, 0x1.8p+0)
Result:
is: 5.77220822056619098462e+307 0x1.48cbbfb90414b0000000p+1022
should be: 5.77220822056602632779e+307 0x1.48cbbfb9040a60000000p+1022
difference: 1.64656825536614384462e+294 0x1.4a000000000000000000p+977
ulp : 165.0000
max.ulp : 0.0000
Failure: Test: pow_downward (0x2.fa3414de4p+680, 0x1.8p+0)
Result:
is: 5.77220822056619098461e+307 0x1.48cbbfb90414b0000000p+1022
should be: 5.77220822056602632779e+307 0x1.48cbbfb9040a60000000p+1022
difference: 1.64656825536614384461e+294 0x1.4a000000000000000000p+977
ulp : 165.0000
max.ulp : 1.0000
Failure: Test: pow_towardzero (0x2.fa3414de4p+680, 0x1.8p+0)
Result:
is: 5.77220822056619098461e+307 0x1.48cbbfb90414b0000000p+1022
should be: 5.77220822056602632779e+307 0x1.48cbbfb9040a60000000p+1022
difference: 1.64656825536614384461e+294 0x1.4a000000000000000000p+977
ulp : 165.0000
max.ulp : 1.0000
Failure: Test: pow_upward (0x2.fa3414de4p+680, 0x1.8p+0)
Result:
is: 5.77220822056619098462e+307 0x1.48cbbfb90414b0000000p+1022
should be: 5.77220822056602732572e+307 0x1.48cbbfb9040a70000000p+1022
difference: 1.63658905381847024556e+294 0x1.48000000000000000000p+977
ulp : 164.0000
max.ulp : 1.0000
>
> 2015-03-10 Joseph Myers <joseph@codesourcery.com>
>
> [BZ #18104]
> * math/auto-libm-test-in: Add another test of pow.
> * math/auto-libm-test-out: Regenerated.
>
> diff --git a/math/auto-libm-test-in b/math/auto-libm-test-in
> index 5e4b84d..4a9f935 100644
> --- a/math/auto-libm-test-in
> +++ b/math/auto-libm-test-in
> @@ -2015,6 +2015,7 @@ pow 2.0 -100000.0
>
> pow 1.0625 1.125
> pow 1.5 1.03125
> +pow 0x1.7d1a0a6f2p+681 1.5
>
> sin 0
> sin -0
> diff --git a/math/auto-libm-test-out b/math/auto-libm-test-out
> index 66bdeb4..223caf2 100644
> --- a/math/auto-libm-test-out
> +++ b/math/auto-libm-test-out
> @@ -166089,6 +166089,51 @@ pow 1.5 1.03125
> = pow tonearest ldbl-128ibm 0x1.8p+0L 0x1.08p+0L : 0x1.84e58377727ac18c4b0e8b54f08p+0L : inexact-ok
> = pow towardzero ldbl-128ibm 0x1.8p+0L 0x1.08p+0L : 0x1.84e58377727ac18c4b0e8b54f08p+0L : inexact-ok
> = pow upward ldbl-128ibm 0x1.8p+0L 0x1.08p+0L : 0x1.84e58377727ac18c4b0e8b54f1p+0L : inexact-ok
> +pow 0x1.7d1a0a6f2p+681 1.5
> += pow downward flt-32 0xf.fffffp+124f 0x1.8p+0f : 0xf.fffffp+124f : inexact-ok overflow errno-erange-ok
> += pow tonearest flt-32 0xf.fffffp+124f 0x1.8p+0f : plus_infty : inexact-ok overflow errno-erange
> += pow towardzero flt-32 0xf.fffffp+124f 0x1.8p+0f : 0xf.fffffp+124f : inexact-ok overflow errno-erange-ok
> += pow upward flt-32 0xf.fffffp+124f 0x1.8p+0f : plus_infty : inexact-ok overflow errno-erange
> += pow downward dbl-64 0xf.fffffp+124 0x1.8p+0 : 0xf.ffffe8000006p+188 : inexact-ok
> += pow tonearest dbl-64 0xf.fffffp+124 0x1.8p+0 : 0xf.ffffe8000006p+188 : inexact-ok
> += pow towardzero dbl-64 0xf.fffffp+124 0x1.8p+0 : 0xf.ffffe8000006p+188 : inexact-ok
> += pow upward dbl-64 0xf.fffffp+124 0x1.8p+0 : 0xf.ffffe80000068p+188 : inexact-ok
> += pow downward ldbl-96-intel 0xf.fffffp+124L 0x1.8p+0L : 0xf.ffffe8000006p+188L : inexact-ok
> += pow tonearest ldbl-96-intel 0xf.fffffp+124L 0x1.8p+0L : 0xf.ffffe8000006p+188L : inexact-ok
> += pow towardzero ldbl-96-intel 0xf.fffffp+124L 0x1.8p+0L : 0xf.ffffe8000006p+188L : inexact-ok
> += pow upward ldbl-96-intel 0xf.fffffp+124L 0x1.8p+0L : 0xf.ffffe8000006001p+188L : inexact-ok
> += pow downward ldbl-96-m68k 0xf.fffffp+124L 0x1.8p+0L : 0xf.ffffe8000006p+188L : inexact-ok
> += pow tonearest ldbl-96-m68k 0xf.fffffp+124L 0x1.8p+0L : 0xf.ffffe8000006p+188L : inexact-ok
> += pow towardzero ldbl-96-m68k 0xf.fffffp+124L 0x1.8p+0L : 0xf.ffffe8000006p+188L : inexact-ok
> += pow upward ldbl-96-m68k 0xf.fffffp+124L 0x1.8p+0L : 0xf.ffffe8000006001p+188L : inexact-ok
> += pow downward ldbl-128 0xf.fffffp+124L 0x1.8p+0L : 0xf.ffffe80000060000010000006p+188L : inexact-ok
> += pow tonearest ldbl-128 0xf.fffffp+124L 0x1.8p+0L : 0xf.ffffe80000060000010000006p+188L : inexact-ok
> += pow towardzero ldbl-128 0xf.fffffp+124L 0x1.8p+0L : 0xf.ffffe80000060000010000006p+188L : inexact-ok
> += pow upward ldbl-128 0xf.fffffp+124L 0x1.8p+0L : 0xf.ffffe80000060000010000006008p+188L : inexact-ok
> += pow downward ldbl-128ibm 0xf.fffffp+124L 0x1.8p+0L : 0xf.ffffe80000060000010000006p+188L : inexact-ok
> += pow tonearest ldbl-128ibm 0xf.fffffp+124L 0x1.8p+0L : 0xf.ffffe80000060000010000006p+188L : inexact-ok
> += pow towardzero ldbl-128ibm 0xf.fffffp+124L 0x1.8p+0L : 0xf.ffffe80000060000010000006p+188L : inexact-ok
> += pow upward ldbl-128ibm 0xf.fffffp+124L 0x1.8p+0L : 0xf.ffffe800000600000100000064p+188L : inexact-ok
> += pow downward dbl-64 0x2.fa3414de4p+680 0x1.8p+0 : 0x5.232efee410298p+1020 : inexact-ok
> += pow tonearest dbl-64 0x2.fa3414de4p+680 0x1.8p+0 : 0x5.232efee410298p+1020 : inexact-ok
> += pow towardzero dbl-64 0x2.fa3414de4p+680 0x1.8p+0 : 0x5.232efee410298p+1020 : inexact-ok
> += pow upward dbl-64 0x2.fa3414de4p+680 0x1.8p+0 : 0x5.232efee41029cp+1020 : inexact-ok
> += pow downward ldbl-96-intel 0x2.fa3414de4p+680L 0x1.8p+0L : 0x5.232efee41029ap+1020L : inexact-ok
> += pow tonearest ldbl-96-intel 0x2.fa3414de4p+680L 0x1.8p+0L : 0x5.232efee41029ap+1020L : inexact-ok
> += pow towardzero ldbl-96-intel 0x2.fa3414de4p+680L 0x1.8p+0L : 0x5.232efee41029ap+1020L : inexact-ok
> += pow upward ldbl-96-intel 0x2.fa3414de4p+680L 0x1.8p+0L : 0x5.232efee41029ap+1020L : inexact-ok
> += pow downward ldbl-96-m68k 0x2.fa3414de4p+680L 0x1.8p+0L : 0x5.232efee41029ap+1020L : inexact-ok
> += pow tonearest ldbl-96-m68k 0x2.fa3414de4p+680L 0x1.8p+0L : 0x5.232efee41029ap+1020L : inexact-ok
> += pow towardzero ldbl-96-m68k 0x2.fa3414de4p+680L 0x1.8p+0L : 0x5.232efee41029ap+1020L : inexact-ok
> += pow upward ldbl-96-m68k 0x2.fa3414de4p+680L 0x1.8p+0L : 0x5.232efee41029ap+1020L : inexact-ok
> += pow downward ldbl-128 0x2.fa3414de4p+680L 0x1.8p+0L : 0x5.232efee41029ap+1020L : inexact-ok
> += pow tonearest ldbl-128 0x2.fa3414de4p+680L 0x1.8p+0L : 0x5.232efee41029ap+1020L : inexact-ok
> += pow towardzero ldbl-128 0x2.fa3414de4p+680L 0x1.8p+0L : 0x5.232efee41029ap+1020L : inexact-ok
> += pow upward ldbl-128 0x2.fa3414de4p+680L 0x1.8p+0L : 0x5.232efee41029ap+1020L : inexact-ok
> += pow downward ldbl-128ibm 0x2.fa3414de4p+680L 0x1.8p+0L : 0x5.232efee41029ap+1020L : inexact-ok
> += pow tonearest ldbl-128ibm 0x2.fa3414de4p+680L 0x1.8p+0L : 0x5.232efee41029ap+1020L : inexact-ok
> += pow towardzero ldbl-128ibm 0x2.fa3414de4p+680L 0x1.8p+0L : 0x5.232efee41029ap+1020L : inexact-ok
> += pow upward ldbl-128ibm 0x2.fa3414de4p+680L 0x1.8p+0L : 0x5.232efee41029ap+1020L : inexact-ok
> sin 0
> = sin downward flt-32 0x0p+0f : 0x0p+0f : inexact-ok
> = sin tonearest flt-32 0x0p+0f : 0x0p+0f : inexact-ok
>
More information about the Libc-alpha
mailing list