diff --git a/backport-0002-Fix-bug-in-mpc_pow_fr.patch b/backport-0002-Fix-bug-in-mpc_pow_fr.patch index 2de84a624647c61acd6f20ed979d5330bd197848..d27e0b2d84414b8326a32e543dd89a2155c364b7 100644 --- a/backport-0002-Fix-bug-in-mpc_pow_fr.patch +++ b/backport-0002-Fix-bug-in-mpc_pow_fr.patch @@ -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 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. * 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. * NEWS: Add entry. --- - NEWS | 3 + - doc/algorithms.tex | 9 +++ - src/pow.c | 146 +++++++++++++++++++++++++-------------------- - tests/pow_fr.dat | 7 ++- - 4 files changed, 99 insertions(+), 66 deletions(-) + src/pow.c | 146 ++++++++++++++++++++++++++--------------------- + tests/pow_fr.dat | 8 ++- + 2 files changed, 89 insertions(+), 65 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 -index 0fc6932..2bab8b8 100644 +index 4fc90ae..185ef60 100644 --- a/src/pow.c +++ b/src/pow.c @@ -1,6 +1,6 @@ @@ -79,7 +47,7 @@ index 0fc6932..2bab8b8 100644 if (is_odd (mpc_realref(y), -1)) /* y/2 is odd */ z_imag = 1; 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) { @@ -237,7 +205,7 @@ index 0fc6932..2bab8b8 100644 else ret = mpc_set (z, u, rnd); 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 +++ b/tests/pow_fr.dat @@ -1,6 +1,6 @@ @@ -248,15 +216,16 @@ index 66162c9..632c39a 100644 # # 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 - - # 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 ++ ++# issue revealed by random tests (with GMP_CHECK_RANDOMIZE=1669437260) +- 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 -- -2.33.0 +2.36.1 diff --git a/backport-0004-Correct-signs-of-0-parts-in-exact-Karatsuba-multipli.patch b/backport-0004-Correct-signs-of-0-parts-in-exact-Karatsuba-multipli.patch index d3543169218b4907ca08dd0354bf1d17916fd8e7..7e2671fbb38a7a3eac9b083af17c7daded3f18ee 100644 --- a/backport-0004-Correct-signs-of-0-parts-in-exact-Karatsuba-multipli.patch +++ b/backport-0004-Correct-signs-of-0-parts-in-exact-Karatsuba-multipli.patch @@ -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 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 exact 0. @@ -12,18 +16,18 @@ Subject: [PATCH] Correct signs of 0 parts in exact Karatsuba multiplication. 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mul.c b/src/mul.c -index 9ca95e1..e1574a1 100644 +index 61092e5..6a2c79f 100644 --- a/src/mul.c +++ b/src/mul.c @@ -1,6 +1,6 @@ /* 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, 2020, 2022 INRIA +-Copyright (C) 2002, 2004, 2005, 2008, 2009, 2010, 2011, 2012, 2016 INRIA ++Copyright (C) 2002, 2004, 2005, 2008, 2009, 2010, 2011, 2012, 2016, 2022 INRIA 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 need the correct values of op1 and op2. So we just create a new variable for the result in this case. */ @@ -31,7 +35,7 @@ index 9ca95e1..e1574a1 100644 int loop; 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 -index ad2515a..b560098 100644 +index 3f36e7c..51345fd 100644 --- a/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 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 +0 0 1473 -50 1473 +0 20 1 20 2 20 -10 20 20 N N -- -2.33.0 +2.36.1 diff --git a/libmpc.spec b/libmpc.spec index 8ccf916e86a78de2c5d096203fddc5494d2e8f97..e8667e138d9ad6b4e69e201faa202e60153e4ef6 100644 --- a/libmpc.spec +++ b/libmpc.spec @@ -1,6 +1,6 @@ Name: libmpc Version: 1.2.0 -Release: 6 +Release: 7 Summary: C library for multiple precision complex arithmetic License: LGPLv3+ and GFDL-1.3-only URL: http://www.multiprecision.org/ @@ -33,6 +33,9 @@ Header files and shared object symlinks for MPC is a C library. %prep %setup -q -n mpc-%{version} %patch6000 -p1 +%patch6001 -p1 +%patch6002 -p1 +%patch6003 -p1 %build %configure --disable-static @@ -75,6 +78,9 @@ fi %{_libdir}/libmpc.so %changelog +* Fri May 5 2023 volcanodragon - 1.2.0-7 +- fix the bug that bugfix patches are not patched. + * Thu Apr 20 2023 Hewenliang - 1.2.0-6 - backport some bugfix patches.