fix the bug that patches are not patched

(cherry picked from commit a911dc49017b6b90280d97e958285719b4080dd6)
This commit is contained in:
volcanodragon 2023-05-05 10:37:23 +08:00 committed by openeuler-sync-bot
parent 284852fde4
commit eaa301e6e4
3 changed files with 39 additions and 60 deletions

View File

@ -1,7 +1,11 @@
From f04c4ccf618dfb01fe6d878f602006a643f13071 Mon Sep 17 00:00:00 2001 From 99595c0f98241bc27ddc63756e4e8ec932c1b9da Mon Sep 17 00:00:00 2001
From: Andreas Enge <andreas.enge@inria.fr> From: Andreas Enge <andreas.enge@inria.fr>
Date: Mon, 28 Nov 2022 12:48:56 +0100 Date: Mon, 28 Nov 2022 12:48:56 +0100
Subject: [PATCH] Fix bug in mpc_pow_fr. Subject: [PATCH 1/3] Fix bug in mpc_pow_fr.
Reference:https://gitlab.inria.fr/mpc/mpc/-/commit/f04c4ccf618dfb01fe6d878f602006a643f13071
Conflict:Context differences in tests/pow_fr.dat, NEWS and
doc/algorithms.tex(doesn't exist)
* tests/pow_fr.dat: Correct test and add more tests. * tests/pow_fr.dat: Correct test and add more tests.
* src/pow.c (mpc_pow): Correct sign of zero part in result for c*(1+I) * src/pow.c (mpc_pow): Correct sign of zero part in result for c*(1+I)
@ -9,48 +13,12 @@ Subject: [PATCH] Fix bug in mpc_pow_fr.
* doc/algorithms.tex: Add comment concerning the sign. * doc/algorithms.tex: Add comment concerning the sign.
* NEWS: Add entry. * NEWS: Add entry.
--- ---
NEWS | 3 + src/pow.c | 146 ++++++++++++++++++++++++++---------------------
doc/algorithms.tex | 9 +++ tests/pow_fr.dat | 8 ++-
src/pow.c | 146 +++++++++++++++++++++++++-------------------- 2 files changed, 89 insertions(+), 65 deletions(-)
tests/pow_fr.dat | 7 ++-
4 files changed, 99 insertions(+), 66 deletions(-)
diff --git a/NEWS b/NEWS
index ba37c9d..6926338 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,9 @@ Changes in version 1.3.0:
- New experimental function: mpc_eta_fund
- Bug fixes:
- mpc_asin for asin(z) with small |Re(z)| and tiny |Im(z)|
+ - mpc_pow_fr: sign of zero part of result when the base has up to sign
+ the same real and imaginary part, and the exponent is an even
+ positive integer
- mpc_fma
Changes in version 1.2.1, released in October 2020:
diff --git a/doc/algorithms.tex b/doc/algorithms.tex
index aaff643..4cdbb09 100644
--- a/doc/algorithms.tex
+++ b/doc/algorithms.tex
@@ -2126,6 +2126,15 @@ the determined cases:
where $\sigma_2$ (resp $\rho_1$, $\rho_2$) is the sign of $x_2$ (resp. $y_1$,
$y_2$) and with the convention $0^0=+1$.
+FIXME: This misses the cases $(x_1 \pm x_1 i)^{y_1 + 0 i}$ for $y_1 \geq 2$
+even and $x_1 \neq 0$; the case (d)(ii) above applies when $x_2 > 0$, but
+misses $x_2 < 0$. In any case, the sign of the imaginary part
+(for $y_1$ divisible by~$4$)
+or the real part
+(for $y_1$ divisible by~$2$, but not by~$4$)
+cannot be determined.
+
+
\subsection {\texttt {mpc\_pow\_ui}}
\label {ssec:mpcpowui}
diff --git a/src/pow.c b/src/pow.c diff --git a/src/pow.c b/src/pow.c
index 0fc6932..2bab8b8 100644 index 4fc90ae..185ef60 100644
--- a/src/pow.c --- a/src/pow.c
+++ b/src/pow.c +++ b/src/pow.c
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
@ -79,7 +47,7 @@ index 0fc6932..2bab8b8 100644
if (is_odd (mpc_realref(y), -1)) /* y/2 is odd */ if (is_odd (mpc_realref(y), -1)) /* y/2 is odd */
z_imag = 1; z_imag = 1;
else else
@@ -764,78 +766,94 @@ mpc_pow (mpc_ptr z, mpc_srcptr x, mpc_srcptr y, mpc_rnd_t rnd) @@ -765,78 +767,94 @@ mpc_pow (mpc_ptr z, mpc_srcptr x, mpc_srcptr y, mpc_rnd_t rnd)
if (z_real) if (z_real)
{ {
@ -237,7 +205,7 @@ index 0fc6932..2bab8b8 100644
else else
ret = mpc_set (z, u, rnd); ret = mpc_set (z, u, rnd);
diff --git a/tests/pow_fr.dat b/tests/pow_fr.dat diff --git a/tests/pow_fr.dat b/tests/pow_fr.dat
index 66162c9..632c39a 100644 index 0816c13..632c39a 100644
--- a/tests/pow_fr.dat --- a/tests/pow_fr.dat
+++ b/tests/pow_fr.dat +++ b/tests/pow_fr.dat
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
@ -248,15 +216,16 @@ index 66162c9..632c39a 100644
# #
# This file is part of GNU MPC. # This file is part of GNU MPC.
# #
@@ -74,4 +74,7 @@ @@ -72,3 +72,9 @@
# (+0 0.75)^7 = (-0 -0.13348388671875) is rounded to (-0 -0.125)
0 + 2 -0 2 -0x1p-3 2 +0 2 0x3p-2 3 7 N N
0 - 8 -0 8 -0x89p-10 2 +0 2 0x3p-2 3 7 N N 0 - 8 -0 8 -0x89p-10 2 +0 2 0x3p-2 3 7 N N
+
# issue revealed by random tests (with GMP_CHECK_RANDOMIZE=1669437260) +# issue revealed by random tests (with GMP_CHECK_RANDOMIZE=1669437260)
-- 0 2 -0x1p-28 2 +0 2 0x1.8p-8 2 0x1.8p-8 2 4 N N
+- 0 2 -0x3p-29 2 +0 2 0x1.8p-8 2 0x1.8p-8 2 4 N N +- 0 2 -0x3p-29 2 +0 2 0x1.8p-8 2 0x1.8p-8 2 4 N N
+- 0 2 -0x3p-29 2 +0 2 0x1.8p-8 2 -0x1.8p-8 2 4 N N +- 0 2 -0x3p-29 2 +0 2 0x1.8p-8 2 -0x1.8p-8 2 4 N N
+0 - 2 +0 2 0x1p-14 2 0x1.8p-8 2 0x1.8p-8 2 2 N N +0 - 2 +0 2 0x1p-14 2 0x1.8p-8 2 0x1.8p-8 2 2 N N
+0 + 2 +0 2 -0x1p-14 2 0x1.8p-8 2 -0x1.8p-8 2 2 N N +0 + 2 +0 2 -0x1p-14 2 0x1.8p-8 2 -0x1.8p-8 2 2 N N
-- --
2.33.0 2.36.1

View File

@ -1,7 +1,11 @@
From 153108f96fad542bf772b02abb95c748743b27da Mon Sep 17 00:00:00 2001 From a7928271cd02820faae17608bfb99170a174406d Mon Sep 17 00:00:00 2001
From: Andreas Enge <andreas.enge@inria.fr> From: Andreas Enge <andreas.enge@inria.fr>
Date: Wed, 30 Nov 2022 18:01:50 +0100 Date: Wed, 30 Nov 2022 18:01:50 +0100
Subject: [PATCH] Correct signs of 0 parts in exact Karatsuba multiplication. Subject: [PATCH 3/3] Correct signs of 0 parts in exact Karatsuba
multiplication.
Reference:https://gitlab.inria.fr/mpc/mpc/-/commit/153108f96fad542bf772b02abb95c748743b27da
Conflict:Context differences in src/mul.c for Copyright record
* src/mul.c (mpc_mul_karatsuba): Clear sign if a part of a result is an * src/mul.c (mpc_mul_karatsuba): Clear sign if a part of a result is an
exact 0. exact 0.
@ -12,18 +16,18 @@ Subject: [PATCH] Correct signs of 0 parts in exact Karatsuba multiplication.
2 files changed, 17 insertions(+), 1 deletion(-) 2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/mul.c b/src/mul.c diff --git a/src/mul.c b/src/mul.c
index 9ca95e1..e1574a1 100644 index 61092e5..6a2c79f 100644
--- a/src/mul.c --- a/src/mul.c
+++ b/src/mul.c +++ b/src/mul.c
@@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/* mpc_mul -- Multiply two complex numbers /* mpc_mul -- Multiply two complex numbers
-Copyright (C) 2002, 2004, 2005, 2008, 2009, 2010, 2011, 2012, 2016, 2020 INRIA -Copyright (C) 2002, 2004, 2005, 2008, 2009, 2010, 2011, 2012, 2016 INRIA
+Copyright (C) 2002, 2004, 2005, 2008, 2009, 2010, 2011, 2012, 2016, 2020, 2022 INRIA +Copyright (C) 2002, 2004, 2005, 2008, 2009, 2010, 2011, 2012, 2016, 2022 INRIA
This file is part of GNU MPC. This file is part of GNU MPC.
@@ -219,6 +219,7 @@ mpc_mul_karatsuba (mpc_ptr rop, mpc_srcptr op1, mpc_srcptr op2, mpc_rnd_t rnd) @@ -416,6 +416,7 @@ mpc_mul_karatsuba (mpc_ptr rop, mpc_srcptr op1, mpc_srcptr op2, mpc_rnd_t rnd)
imaginary part is used). If this fails, we have to start again and imaginary part is used). If this fails, we have to start again and
need the correct values of op1 and op2. need the correct values of op1 and op2.
So we just create a new variable for the result in this case. */ So we just create a new variable for the result in this case. */
@ -31,7 +35,7 @@ index 9ca95e1..e1574a1 100644
int loop; int loop;
const int MAX_MUL_LOOP = 1; const int MAX_MUL_LOOP = 1;
@@ -424,6 +425,18 @@ mpc_mul_karatsuba (mpc_ptr rop, mpc_srcptr op1, mpc_srcptr op2, mpc_rnd_t rnd) @@ -621,6 +622,18 @@ mpc_mul_karatsuba (mpc_ptr rop, mpc_srcptr op1, mpc_srcptr op2, mpc_rnd_t rnd)
} }
} }
@ -51,10 +55,10 @@ index 9ca95e1..e1574a1 100644
} }
diff --git a/tests/mul.dat b/tests/mul.dat diff --git a/tests/mul.dat b/tests/mul.dat
index ad2515a..b560098 100644 index 3f36e7c..51345fd 100644
--- a/tests/mul.dat --- a/tests/mul.dat
+++ b/tests/mul.dat +++ b/tests/mul.dat
@@ -184,3 +184,6 @@ @@ -182,3 +182,6 @@
+ 0 2 1 2 0x2p-536870913 2 1 2 0x1p-536870913 2 1 2 0x1p-536870913 N N + 0 2 1 2 0x2p-536870913 2 1 2 0x1p-536870913 2 1 2 0x1p-536870913 N N
0 - 2 0 2 1 2 0x1p-536870913 2 1 2 1 2 0x1p-536870913 N N 0 - 2 0 2 1 2 0x1p-536870913 2 1 2 1 2 0x1p-536870913 N N
@ -62,5 +66,5 @@ index ad2515a..b560098 100644
+# error in sign of 0 with exact Karatsuba found on 2022-11-30 +# error in sign of 0 with exact Karatsuba found on 2022-11-30
+0 0 1473 -50 1473 +0 20 1 20 2 20 -10 20 20 N N +0 0 1473 -50 1473 +0 20 1 20 2 20 -10 20 20 N N
-- --
2.33.0 2.36.1

View File

@ -1,6 +1,6 @@
Name: libmpc Name: libmpc
Version: 1.2.0 Version: 1.2.0
Release: 6 Release: 7
Summary: C library for multiple precision complex arithmetic Summary: C library for multiple precision complex arithmetic
License: LGPLv3+ and GFDL-1.3-only License: LGPLv3+ and GFDL-1.3-only
URL: http://www.multiprecision.org/ URL: http://www.multiprecision.org/
@ -33,6 +33,9 @@ Header files and shared object symlinks for MPC is a C library.
%prep %prep
%setup -q -n mpc-%{version} %setup -q -n mpc-%{version}
%patch6000 -p1 %patch6000 -p1
%patch6001 -p1
%patch6002 -p1
%patch6003 -p1
%build %build
%configure --disable-static %configure --disable-static
@ -75,6 +78,9 @@ fi
%{_libdir}/libmpc.so %{_libdir}/libmpc.so
%changelog %changelog
* Fri May 5 2023 volcanodragon<linfeilong@huawei.com> - 1.2.0-7
- fix the bug that bugfix patches are not patched.
* Thu Apr 20 2023 Hewenliang<hewenliang4@huawei.com> - 1.2.0-6 * Thu Apr 20 2023 Hewenliang<hewenliang4@huawei.com> - 1.2.0-6
- backport some bugfix patches. - backport some bugfix patches.