[packages/mpfi] Rel 2; patch from gentoo

arekm arekm at pld-linux.org
Sat Mar 21 00:22:06 CET 2026


commit 58793deaf37ca25eedeb5f709bb85f519bcf1313
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sat Mar 21 00:21:56 2026 +0100

    Rel 2; patch from gentoo

 mpfi-tests.patch | 275 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 mpfi.spec        |   4 +-
 2 files changed, 278 insertions(+), 1 deletion(-)
---
diff --git a/mpfi.spec b/mpfi.spec
index b9c7dd7..c822315 100644
--- a/mpfi.spec
+++ b/mpfi.spec
@@ -7,13 +7,14 @@ Summary:	Multiple-precision floating-point interval library
 Summary(pl.UTF-8):	Biblioteka przedziałów zmiennoprzecinkowych wielokrotnej precyzji
 Name:		mpfi
 Version:	1.5.4
-Release:	1
+Release:	2
 License:	LGPL v2.1+
 Group:		Libraries
 Source0:	http://perso.ens-lyon.fr/nathalie.revol/softwares/%{name}-%{version}.tar.xz
 # Source0-md5:	efff5c254d1af49f42ed75cbcd9166db
 Patch0:		%{name}-info.patch
 Patch1:		%{name}-missing.patch
+Patch2:		%{name}-tests.patch
 URL:		http://perso.ens-lyon.fr/nathalie.revol/software.html
 BuildRequires:	gmp-devel >= 4.1
 BuildRequires:	mpfr-devel >= 4.0.1
@@ -79,6 +80,7 @@ Statyczna biblioteka MPFI.
 %setup -q
 %patch -P0 -p1
 %patch -P1 -p1
+%patch -P2 -p1
 
 %build
 %configure \
diff --git a/mpfi-tests.patch b/mpfi-tests.patch
new file mode 100644
index 0000000..4e404ee
--- /dev/null
+++ b/mpfi-tests.patch
@@ -0,0 +1,275 @@
+From 4116d242e7af999bce6cf6f1f525cda353469bd6 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael at orlitzky.com>
+Date: Thu, 12 Sep 2024 15:41:16 -0400
+Subject: [PATCH 2/3] tests/{trec_sqrt.c,rec_sqrt.dat}: fix as many tests as
+ possible
+
+The mpfi_rec_sqrt() function isn't tested at all, because this doesn't
+even compile. First we switch a "I" to a "II" to indicate that it's a
+two-argument function (an in value and an out value). Then, the random
+tests actually pass! But most of the check_data() examples don't, and
+who can say why. I've simply deleted the ones that don't pass? Now "by
+construction," everything passes.
+---
+ tests/rec_sqrt.dat | 19 -------------------
+ tests/trec_sqrt.c  |  2 +-
+ 2 files changed, 1 insertion(+), 20 deletions(-)
+
+diff --git a/tests/rec_sqrt.dat b/tests/rec_sqrt.dat
+index fb7e69e..45c8488 100644
+--- a/tests/rec_sqrt.dat
++++ b/tests/rec_sqrt.dat
+@@ -6,26 +6,7 @@
+ 0 53   nan   nan    53  nan  nan
+ 0 53   nan   nan    53  nan -inf
+ 0 53   nan   nan    53   -7  nan
+-0 53  -inf   nan    53  nan   -0
+-0 53   nan  +inf    53   +0  nan
+-0 53    +1   nan    53  nan   +1
+-0 53   nan    +0    53 +inf  nan
+ 0 53   nan   nan    53 -inf -inf
+ 0 53   nan   nan    53 -inf   -7
+-0 53   nan    -0    53 -inf   -0
+-0 53   nan    -0    53 -inf   -0
+-0 53   nan    +3    53 -inf   +9
+-0 53   nan  +inf    53 -inf +inf
+-0 53  +inf  +inf    53   +0   -0
+-0 53 +0.25  +inf    53   +0  +16
+ 0 53    +0  +inf    53   +0 +inf
+-0 53    +0 +0.25    53  +16 +inf
+-0 53  +inf  +inf    53 +inf +inf
+ 
+-# regular values
+-0 53  +0.25 			+0.5
+-  53  +4                        +16
+-1 53  +0.5			+0xb.504f333f9de68p-1
+-  53  +2			+4
+-2 53  +0x9.3cd3a2c8198ep-1 	+0xb.504f333f9de68p-1
+-  53  +2			+3
+diff --git a/tests/trec_sqrt.c b/tests/trec_sqrt.c
+index 8ca276f..a507697 100644
+--- a/tests/trec_sqrt.c
++++ b/tests/trec_sqrt.c
+@@ -31,7 +31,7 @@ main (int argc, char **argv)
+ {
+   struct mpfi_function_t i_rec_sqrt;
+ 
+-  mpfi_fun_init_I (&i_rec_sqrt, mpfr_rec_sqrt, mpfr_rec_sqrt);
++  mpfi_fun_init_II (&i_rec_sqrt, mpfi_rec_sqrt, mpfr_rec_sqrt);
+   test_start ();
+ 
+   check_data (&i_rec_sqrt, "rec_sqrt.dat");
+-- 
+2.46.0
+
+From 533cb95f8a4aa8a59e780093b92e0cf530ebae60 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael at orlitzky.com>
+Date: Thu, 12 Sep 2024 15:43:55 -0400
+Subject: [PATCH 3/3] tests: fixup mpfi_div_ext() tests
+
+Again this function was not tested at all, because there was a type
+mismatch in the test file, and if you fixed that then it segfaulted
+because the type_iiii.c implementation was never finished. I've tried
+to hack it together, and to my surprise, it mostly works. The examples
+that don't have been deleted without trying to explain them.
+---
+ tests/div_ext.dat  | 45 ---------------------------------------------
+ tests/mpfi-tests.h |  3 +--
+ tests/tdiv_ext.c   |  4 ++--
+ tests/type_ii.c    | 26 ++++++++++++++++++--------
+ tests/type_iiii.c  |  8 ++++----
+ 5 files changed, 25 insertions(+), 61 deletions(-)
+
+diff --git a/tests/div_ext.dat b/tests/div_ext.dat
+index d832390..6fa097b 100644
+--- a/tests/div_ext.dat
++++ b/tests/div_ext.dat
+@@ -33,51 +33,6 @@
+ 0 53  nan  nan 	53  nan  nan   53  nan   -7 53 +inf +inf
+ 0 53  nan  nan 	53  nan  nan   53  nan   +1 53  nan   -0
+ 
+-2 53 -inf -2 	53  +0  +inf   53 -inf   -6 53 -inf   +3
+-2 53 -inf -2 	53  +3  +inf   53 -inf   -6 53   -2   +3
+-2 53 -inf -0 	53  +3  +inf   53 -inf   -6 53   -2 +inf
+-1 53 -inf +inf 	53  nan  nan   53 -inf   -6 53 -inf +inf
+-
+-2 53 -inf -2 	53  +0  +inf   53  -24   -6 53 -inf   +3
+-2 53 -inf -2 	53  +3  +inf   53  -24   -6 53   -2   +3
+-2 53 -inf -0 	53  +3  +inf   53  -24   -6 53   -2 +inf
+-1 53 -inf +inf 	53  nan  nan   53  -24   -6 53 -inf +inf
+-
+-1 53 -inf +inf 	53  nan  nan   53 -inf   -0 53 -inf   +3
+-1 53 -inf +inf 	53  nan  nan   53 -inf   -0 53   -2   +3
+-1 53 -inf +inf 	53  nan  nan   53 -inf   -0 53   -2 +inf
+-1 53 -inf +inf 	53  nan  nan   53 -inf   -0 53 -inf +inf
+-
+-1 53 -inf +inf 	53  nan  nan   53  -24   -0 53 -inf   +3
+-1 53 -inf +inf 	53  nan  nan   53  -24   -0 53   -2   +3
+-1 53 -inf +inf 	53  nan  nan   53  -24   -0 53   -2 +inf
+-1 53 -inf +inf 	53  nan  nan   53  -24   -0 53 -inf +inf
+-
+-1 53 -inf +inf 	53  nan  nan   53  -24   +6 53 -inf   +3
+-1 53 -inf +inf 	53  nan  nan   53  -24   +6 53   -2   +3
+-1 53 -inf +inf 	53  nan  nan   53  -24   +6 53   -2 +inf
+-1 53 -inf +inf 	53  nan  nan   53  -24   +6 53 -inf +inf
+-
+-1 53 -inf +inf 	53  nan  nan   53   +0   +6 53 -inf   +3
+-1 53 -inf +inf 	53  nan  nan   53   +0   +6 53   -2   +3
+-1 53 -inf +inf 	53  nan  nan   53   +0   +6 53   -2 +inf
+-1 53 -inf +inf 	53  nan  nan   53   +0   +6 53 -inf +inf
+-
+-1 53 -inf +inf 	53  nan  nan   53   +0 +inf 53 -inf   +3
+-1 53 -inf +inf 	53  nan  nan   53   +0 +inf 53   -2   +3
+-1 53 -inf +inf 	53  nan  nan   53   +0 +inf 53   -2 +inf
+-1 53 -inf +inf 	53  nan  nan   53   +0 +inf 53 -inf +inf
+-
+-2 53 -inf -0 	53  +2  +inf   53   +6  +24 53 -inf   +3
+-2 53 -inf -3 	53  +2  +inf   53   +6  +24 53   -2   +3
+-2 53 -inf -3 	53  +0  +inf   53   +6  +24 53   -2 +inf
+-1 53 -inf +inf 	53  nan  nan   53   +6  +24 53 -inf +inf
+-
+-2 53 -inf -0 	53  +2  +inf   53   +6 +inf 53 -inf   +3
+-2 53 -inf -3 	53  +2  +inf   53   +6 +inf 53   -2   +3
+-2 53 -inf -3 	53  +0  +inf   53   +6 +inf 53   -2 +inf
+-1 53 -inf +inf 	53  nan  nan   53   +6 +inf 53 -inf +inf
+-
+ # above values to be put at the proper place
+ # regular values
+ # 0 53              -0x1p-1           -0x187p-256    53              -0.375 -0x10187p-256 53                -0.125 0x1p-240
+diff --git a/tests/mpfi-tests.h b/tests/mpfi-tests.h
+index 908f5b1..82b2c41 100644
+--- a/tests/mpfi-tests.h
++++ b/tests/mpfi-tests.h
+@@ -57,8 +57,7 @@ typedef int (*IZ_fun)  (mpfi_t, mpz_srcptr);
+ typedef int (*IQ_fun)  (mpfi_t, mpq_srcptr);
+ typedef int (*IR_fun)  (mpfi_t, mpfr_srcptr);
+ typedef int (*III_fun) (mpfi_t, mpfi_srcptr, mpfi_srcptr);
+-/*typedef int (*IIII_fun)(mpfi_t, mpfi_t, mpfi_srcptr, mpfi_srcptr);*/
+-typedef int (*IIII_fun)(mpfi_t, mpfi_srcptr, mpfi_srcptr, mpfi_srcptr);
++typedef int (*IIII_fun)(mpfi_t, mpfi_t, mpfi_srcptr, mpfi_srcptr);
+ typedef int (*IIU_fun) (mpfi_t, mpfi_srcptr, unsigned long);
+ typedef int (*IIS_fun) (mpfi_t, mpfi_srcptr, long);
+ typedef int (*IID_fun) (mpfi_t, mpfi_srcptr, double);
+diff --git a/tests/tdiv_ext.c b/tests/tdiv_ext.c
+index 8f12562..d3d3d93 100644
+--- a/tests/tdiv_ext.c
++++ b/tests/tdiv_ext.c
+@@ -27,12 +27,12 @@ int
+ main (int argc, char **argv)
+ {
+   struct mpfi_function_t i_div_ext;
+-  mpfi_fun_init_IIII (&i_div_ext, mpfi_div_ext, mpfr_div);
++  mpfi_fun_init_IIII (&i_div_ext, mpfi_div_ext, (RRRR_fun)NULL);
+ 
+   test_start ();
+ 
+   check_data (&i_div_ext, "div_ext.dat");
+-  check_random (&i_div_ext, 2, 1000, 10);
++  /*check_random (&i_div_ext, 2, 1000, 10);*/
+ 
+   test_end ();
+   mpfi_fun_clear (&i_div_ext);
+diff --git a/tests/type_ii.c b/tests/type_ii.c
+index 6f7bb17..752fba4 100644
+--- a/tests/type_ii.c
++++ b/tests/type_ii.c
+@@ -52,13 +52,17 @@ check_with_different_prec (mpfi_function_ptr function, mpfr_prec_t prec)
+ 
+   /* rename operands for better readability */
+   int type_II   = MPFI_FUN_TYPE (*function) == II;
++  int type_III   = MPFI_FUN_TYPE (*function) == III;
++  int type_IIII   = MPFI_FUN_TYPE (*function) == IIII;
+   II_fun  f_II  = MPFI_FUN_GET (*function, II);
+   III_fun f_III = MPFI_FUN_GET (*function, III);
++  IIII_fun f_IIII = MPFI_FUN_GET (*function, IIII);
+   mpfi_ptr got      = MPFI_FUN_ARG (*function, 0, mpfi);
+   int expected_inex = MPFI_FUN_ARG (*function, 1, i);
+   mpfi_ptr expected = MPFI_FUN_ARG (*function, 2, mpfi);
+   mpfi_ptr op1      = MPFI_FUN_ARG (*function, 3, mpfi);
+   mpfi_ptr op2      = type_II ? NULL : MPFI_FUN_ARG (*function, 4, mpfi);
++  mpfi_ptr op3      = (type_II || type_III) ? NULL : MPFI_FUN_ARG (*function, 5, mpfi);
+ 
+ 
+   mpfr_init2 (x, prec);
+@@ -66,24 +70,30 @@ check_with_different_prec (mpfi_function_ptr function, mpfr_prec_t prec)
+ 
+   if (type_II)
+     f_II (got, op1);
+-  else
++  else if (type_III)
+     f_III (got, op1, op2);
++  else
++    f_IIII(got, op1, op2, op3);
+ 
+   if (!MPFI_LEFT_IS_INEXACT (expected_inex)) {
+     mpfr_set (x, &(expected->left), MPFI_RNDD);
+     if (!same_mpfr_value (x, &(got->left))) {
+       printf ("Error at precision = %lu (line %lu).\n",
+               (unsigned long)prec, test_line_number);
+-      if (type_II) {
+-        printf ("op = ");
+-        mpfi_out_str (stdout, 16, 0, op1);
+-      }
+-      else {
+-        printf ("op1 = ");
+-        mpfi_out_str (stdout, 16, 0, op1);
++
++      printf ("op = ");
++      mpfi_out_str (stdout, 16, 0, op1);
++
++      if (type_III) {
+         printf ("\nop2 = ");
+         mpfi_out_str (stdout, 16, 0, op2);
+       }
++
++      if (type_IIII) {
++	printf ("\nop3 = ");
++        mpfi_out_str (stdout, 16, 0, op3);
++      }
++
+       printf ("\nleft endpoint: got = ");
+       mpfr_out_str (stdout,  2, 0, &(got->left), MPFI_RNDD);
+       printf ("\n          expected = ");
+diff --git a/tests/type_iiii.c b/tests/type_iiii.c
+index f88ae78..991ddf0 100644
+--- a/tests/type_iiii.c
++++ b/tests/type_iiii.c
+@@ -78,7 +78,7 @@ check_line_iiii (mpfi_function_ptr function)
+     mpfi_out_str (stdout, 16, 0, op1);
+     printf ("\nop2 = ");
+     mpfi_out_str (stdout, 16, 0, op2);
+-    printf ("\ngot      = ");
++    printf ("\nop3      = ");
+     mpfi_out_str (stdout, 16, 0, op3);
+     printf ("\ngot      = ");
+     mpfi_out_str (stdout, 16, 0, got);
+@@ -110,7 +110,7 @@ check_line_iiii (mpfi_function_ptr function)
+       mpfi_out_str (stdout, 16, 0, op1);
+       printf ("\nop2 = ");
+       mpfi_out_str (stdout, 16, 0, op2);
+-      printf ("\ngot      = ");
++      printf ("\nop3      = ");
+       mpfi_out_str (stdout, 16, 0, op3);
+       printf ("\ngot      = ");
+       mpfi_out_str (stdout, 16, 0, got);
+@@ -135,7 +135,7 @@ check_line_iiii (mpfi_function_ptr function)
+       mpfi_out_str (stdout, 16, 0, op1);
+       printf ("\nop2 = ");
+       mpfi_out_str (stdout, 16, 0, op2);
+-      printf ("\ngot      = ");
++      printf ("\nop3      = ");
+       mpfi_out_str (stdout, 16, 0, op3);
+       printf ("\ngot      = ");
+       mpfi_out_str (stdout, 16, 0, got);
+@@ -160,7 +160,7 @@ check_line_iiii (mpfi_function_ptr function)
+       mpfi_out_str (stdout, 16, 0, op1);
+       printf ("\nop2 = ");
+       mpfi_out_str (stdout, 16, 0, op2);
+-      printf ("\ngot      = ");
++      printf ("\nop3      = ");
+       mpfi_out_str (stdout, 16, 0, op3);
+       printf ("\ngot      = ");
+       mpfi_out_str (stdout, 16, 0, got);
+-- 
+2.46.0
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/mpfi.git/commitdiff/58793deaf37ca25eedeb5f709bb85f519bcf1313



More information about the pld-cvs-commit mailing list