Hello community,

here is the log from the commit of package calc for openSUSE:Factory checked in 
at 2018-01-20 11:27:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/calc (Old)
 and      /work/SRC/openSUSE:Factory/.calc.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "calc"

Sat Jan 20 11:27:27 2018 rev:14 rq:567517 version:2.12.6.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/calc/calc.changes        2017-08-10 
14:12:58.741054288 +0200
+++ /work/SRC/openSUSE:Factory/.calc.new/calc.changes   2018-01-20 
11:27:28.338240509 +0100
@@ -1,0 +2,16 @@
+Thu Jan 18 13:19:26 UTC 2018 - [email protected]
+
+- update to 2.12.6.4
+   + Fixed a man page warning about ./myfile
+   + Improved gen_v1(h,n) in lucas.cal for cases where h is not a multiple of 
3. 
+   + Optimized the search for v(1) when h is a multiple of 3.
+
+-------------------------------------------------------------------
+Thu Sep  7 04:08:05 UTC 2017 - [email protected]
+
+- update to 2.12.6.3
+   + Improved gen_v1(h,n) in lucas.cal to use an even faster search method
+   + Improved checking in lucas.cal
+   + Fixed an C code indenting issue in zfunc.c
+
+-------------------------------------------------------------------

Old:
----
  calc-2.12.6.1.tar.bz2

New:
----
  calc-2.12.6.4.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ calc.spec ++++++
--- /var/tmp/diff_new_pack.SjhoAR/_old  2018-01-20 11:27:28.990210019 +0100
+++ /var/tmp/diff_new_pack.SjhoAR/_new  2018-01-20 11:27:28.994209832 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package calc
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %define soname 2
 %define libname libcalc%{soname}
 Name:           calc
-Version:        2.12.6.1
+Version:        2.12.6.4
 Release:        0
 Summary:        C-style arbitrary precision calculator
 License:        LGPL-2.1
@@ -85,8 +85,6 @@
 \tln -s $@ libcustcalc.so
 ' custom/Makefile
 
-sed -i.orig -e 's@^\./myfile@\\a./myfile@g' calc.man
-
 %define _NC_FLAGS %(ncursesw6-config --cflags)
 %define _NC_LIBS %(ncursesw6-config --libs)
 

++++++ calc-2.12.6.1.tar.bz2 -> calc-2.12.6.4.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/calc-2.12.6.1/CHANGES new/calc-2.12.6.4/CHANGES
--- old/calc-2.12.6.1/CHANGES   2017-06-10 00:43:13.000000000 +0200
+++ new/calc-2.12.6.4/CHANGES   2018-01-15 02:10:16.000000000 +0100
@@ -6,6 +6,22 @@
     integers >= 1.  In the case of both rodseth_xhn(x, h, n) and gen_v1(h, n)
     h must be odd.
 
+    Fixed an C code indenting issue that was reported by Thomas Walter
+    <th dot walter42 at gmx dot de> in zfunc.c.
+
+    Fixed a man page warning about ./myfile where the leading dot
+    was mistook for an nroff macro.  Thanks goes to David Haller
+    <dnh at opensuse dot org> for providing the patch.
+
+    Improved gen_v1(h,n) in lucas.cal for cases where h is not a
+    multiple of 3. Optimized the search for v(1) when h is a
+    multiple of 3.
+
+    Fixed a Makefile problem, reported by Doug Hays <doughays6 at gmail
+    dot com>, where if a macOS user set BINDIR, LIBDIR, CALC_SHAREDIR
+    or INCDIR in the top section, their values will be overwritten by
+    the Darwin specific section.
+
 
 The following are the changes from calc version 2.12.6.0 to 2.12.6.0:
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/calc-2.12.6.1/Makefile new/calc-2.12.6.4/Makefile
--- old/calc-2.12.6.1/Makefile  2017-06-06 06:19:21.000000000 +0200
+++ new/calc-2.12.6.4/Makefile  2018-01-15 01:59:41.000000000 +0100
@@ -23,7 +23,7 @@
 #       READLINE_LIB= -lreadline
 #       READLINE_EXTRAS= -lhistory -lncurses
 #
-# Copyright (C) 1999-2017  Landon Curt Noll
+# Copyright (C) 1999-2018  Landon Curt Noll
 #
 # Calc is open software; you can redistribute it and/or modify it under
 # the terms of version 2.1 of the GNU Lesser General Public License
@@ -564,14 +564,30 @@
 #
 #      INCDIR= /dev/env/DJDIR/include
 #
-# If in doubt, set:
+# If in doubt, for non-macOS hosts set:
 #
 #      INCDIR= /usr/include
 #
+# However, if you are on macOS then set:
+#
+#      INCDIR= /usr/local/include
+#if 0  /* start of skip for non-Gnu makefiles */
+ifeq ($(target),Darwin)
+
+# default INCDIR for macOS
+INCDIR= /usr/local/include
+
+else
+#endif /* end of skip for non-Gnu makefiles */
 
+# default INCDIR for non-macOS
+INCDIR= /usr/include
 #INCDIR= /usr/local/include
 #INCDIR= /dev/env/DJDIR/include
-INCDIR= /usr/include
+
+#if 0  /* start of skip for non-Gnu makefiles */
+endif
+#endif /* end of skip for non-Gnu makefiles */
 
 # Where to install calc related things
 #
@@ -602,23 +618,71 @@
 #      LIBDIR= /dev/env/DJDIR/lib
 #      CALC_SHAREDIR= /dev/env/DJDIR/share/calc
 #
-# If in doubt, set:
+# If in doubt, for non-macOS hosts set:
 #
 #      BINDIR= /usr/bin
 #      LIBDIR= /usr/lib
 #      CALC_SHAREDIR= /usr/share/calc
 #
+# However, if you are on macOS then set:
+#
+#      BINDIR= /usr/local/bin
+#      LIBDIR= /usr/local/lib
+#      CALC_SHAREDIR= /usr/local/share/calc
+#
+#      NOTE: Starting with macOS El Capitan OS X 10.11, root by default
+#            could not mkdir under system locations, so macOS must now
+#            use the /usr/local tree.
+
+#if 0  /* start of skip for non-Gnu makefiles */
+ifeq ($(target),Darwin)
+
+# default BINDIR for macOS
+BINDIR= /usr/local/bin
+
+else
+#endif /* end of skip for non-Gnu makefiles */
+
+# default BINDIR for non-macOS
+BINDIR= /usr/bin
 #BINDIR= /usr/local/bin
 #BINDIR= /dev/env/DJDIR/bin
-BINDIR= /usr/bin
 
+#if 0  /* start of skip for non-Gnu makefiles */
+endif
+
+ifeq ($(target),Darwin)
+
+# default LIBDIR for macOS
+LIBDIR= /usr/local/lib
+
+else
+#endif /* end of skip for non-Gnu makefiles */
+
+# default LIBDIR for non-macOS
+LIBDIR= /usr/lib
 #LIBDIR= /usr/local/lib
 #LIBDIR= /dev/env/DJDIR/lib
-LIBDIR= /usr/lib
 
+#if 0  /* start of skip for non-Gnu makefiles */
+endif
+
+ifeq ($(target),Darwin)
+
+# default CALC_SHAREDIR for macOS
+CALC_SHAREDIR= /usr/local/share/calc
+
+else
+#endif /* end of skip for non-Gnu makefiles */
+
+# default CALC_SHAREDIR for non-macOS
+CALC_SHAREDIR= /usr/share/calc
 #CALC_SHAREDIR= /usr/local/lib/calc
 #CALC_SHAREDIR= /dev/env/DJDIR/share/calc
-CALC_SHAREDIR= /usr/share/calc
+
+#if 0  /* start of skip for non-Gnu makefiles */
+endif
+#endif /* end of skip for non-Gnu makefiles */
 
 # NOTE: Do not set CALC_INCDIR to /usr/include or /usr/local/include!!!
 #      Always be sure that the CALC_INCDIR path ends in /calc to avoid
@@ -990,7 +1054,7 @@
 
 # The default calc versions
 #
-VERSION= 2.12.6.1
+VERSION= 2.12.6.4
 
 # Names of shared libraries with versions
 #
@@ -1263,16 +1327,6 @@
 # DARWIN_ARCH= -arch ppc               # PPC binary
 # DARWIN_ARCH= -arch x86_64            # native 64-bit binary
 DARWIN_ARCH=                           # native binary
-#
-# Starting with El Capitan OS X 10.11, root by default could not
-# mkdir under system locations, so we now use the /usr/local tree.
-#
-OPTDIR:= /usr/local
-BINDIR:= /${OPTDIR}/bin
-LIBDIR:= /${OPTDIR}/lib
-CALC_SHAREDIR:= /${OPTDIR}/share
-CALC_INCDIR:= /${OPTDIR}/include
-SCRIPTDIR:= ${BINDIR}/cscript
 endif
 
 ##################
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/calc-2.12.6.1/Makefile.simple 
new/calc-2.12.6.4/Makefile.simple
--- old/calc-2.12.6.1/Makefile.simple   2017-06-15 01:23:02.000000000 +0200
+++ new/calc-2.12.6.4/Makefile.simple   2018-01-17 00:36:25.000000000 +0100
@@ -23,7 +23,7 @@
 #       READLINE_LIB= -lreadline
 #       READLINE_EXTRAS= -lhistory -lncurses
 #
-# Copyright (C) 1999-2017  Landon Curt Noll
+# Copyright (C) 1999-2018  Landon Curt Noll
 #
 # Calc is open software; you can redistribute it and/or modify it under
 # the terms of version 2.1 of the GNU Lesser General Public License
@@ -549,14 +549,19 @@
 #
 #      INCDIR= /dev/env/DJDIR/include
 #
-# If in doubt, set:
+# If in doubt, for non-macOS hosts set:
 #
 #      INCDIR= /usr/include
 #
+# However, if you are on macOS then set:
+#
+#      INCDIR= /usr/local/include
 
+# default INCDIR for non-macOS
+INCDIR= /usr/include
 #INCDIR= /usr/local/include
 #INCDIR= /dev/env/DJDIR/include
-INCDIR= /usr/include
+
 
 # Where to install calc related things
 #
@@ -587,23 +592,40 @@
 #      LIBDIR= /dev/env/DJDIR/lib
 #      CALC_SHAREDIR= /dev/env/DJDIR/share/calc
 #
-# If in doubt, set:
+# If in doubt, for non-macOS hosts set:
 #
 #      BINDIR= /usr/bin
 #      LIBDIR= /usr/lib
 #      CALC_SHAREDIR= /usr/share/calc
 #
+# However, if you are on macOS then set:
+#
+#      BINDIR= /usr/local/bin
+#      LIBDIR= /usr/local/lib
+#      CALC_SHAREDIR= /usr/local/share/calc
+#
+#      NOTE: Starting with macOS El Capitan OS X 10.11, root by default
+#            could not mkdir under system locations, so macOS must now
+#            use the /usr/local tree.
+
+
+# default BINDIR for non-macOS
+BINDIR= /usr/bin
 #BINDIR= /usr/local/bin
 #BINDIR= /dev/env/DJDIR/bin
-BINDIR= /usr/bin
 
+
+# default LIBDIR for non-macOS
+LIBDIR= /usr/lib
 #LIBDIR= /usr/local/lib
 #LIBDIR= /dev/env/DJDIR/lib
-LIBDIR= /usr/lib
 
+
+# default CALC_SHAREDIR for non-macOS
+CALC_SHAREDIR= /usr/share/calc
 #CALC_SHAREDIR= /usr/local/lib/calc
 #CALC_SHAREDIR= /dev/env/DJDIR/share/calc
-CALC_SHAREDIR= /usr/share/calc
+
 
 # NOTE: Do not set CALC_INCDIR to /usr/include or /usr/local/include!!!
 #      Always be sure that the CALC_INCDIR path ends in /calc to avoid
@@ -959,7 +981,7 @@
 
 # The default calc versions
 #
-VERSION= 2.12.6.1
+VERSION= 2.12.6.4
 
 # Names of shared libraries with versions
 #
@@ -1179,16 +1201,6 @@
 # DARWIN_ARCH= -arch ppc               # PPC binary
 # DARWIN_ARCH= -arch x86_64            # native 64-bit binary
 DARWIN_ARCH=                           # native binary
-#
-# Starting with El Capitan OS X 10.11, root by default could not
-# mkdir under system locations, so we now use the /usr/local tree.
-#
-OPTDIR:= /usr/local
-BINDIR:= /${OPTDIR}/bin
-LIBDIR:= /${OPTDIR}/lib
-CALC_SHAREDIR:= /${OPTDIR}/share
-CALC_INCDIR:= /${OPTDIR}/include
-SCRIPTDIR:= ${BINDIR}/cscript
 endif
 
 ##################
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/calc-2.12.6.1/cal/lucas.cal 
new/calc-2.12.6.4/cal/lucas.cal
--- old/calc-2.12.6.1/cal/lucas.cal     2017-06-15 01:13:12.000000000 +0200
+++ new/calc-2.12.6.4/cal/lucas.cal     2018-01-17 00:32:40.000000000 +0100
@@ -28,6 +28,10 @@
  * For a general tutorial on how to find a new largest known prime, see:
  *
  *     http://www.isthe.com/chongo/tech/math/prime/prime-tutorial.pdf
+ *
+ * Also see the reference code, available both C and go:
+ *
+ *     https://github.com/arcetri/goprime
  */
 
 /*
@@ -154,6 +158,12 @@
  *
  * Finally, one should eliminate all values of 'h*2^n-1' where
  * 'h*2^n+1' is divisible by a small primes.
+ *
+ * NOTE: Today, for world record sized h*2^n-1 primes, one might
+ *      search for factors < 2^46 or more.  By excluding h*2^n-1
+ *      with prime factors < 2^46, where h*2^n-1 is a bit larger
+ *      than the largest known prime, one may exclude about 96.5%
+ *      of candidates that have "small" prime factors.
  */
 
 pprod256 = 0;  /* product of  "primes up to 256" / "primes up to 46" */
@@ -739,7 +749,7 @@
  * We can show that X > 2.  See the comments in the rodseth_xhn(x,h,n) above.
  *
  * Some values of X satisfy more often than others. For example a large sample
- * of odd h, h odd multiple of 3 and large n (some around 1e4, some near 1e6,
+ * of h*2^n-1, h odd multiple of 3, and large n (some around 1e4, some near 
1e6,
  * others near 3e7) where the sample size was 66 973 365, here is the count of
  * the smallest value of X that satisfies conditions in Ref4, condition 1:
  *
@@ -805,82 +815,155 @@
  *
  * The above distribution was found to hold fairly well over many values of
  * odd h that are also a multiple of 3 and for many values of n where h < 2^n.
- * For example for in a sample size of 835823 numbers of the form h*2^n-1
- * where odd h >= 12996351 is a multiple of 3, n >= 12996351, these are the
- * smallest v(1) values that were found:
- *
- *  smallest percentage
- *     v(1) used
- *  -------------------
- *        3 40.000%
- *        5 25.683%
- *        9 11.693%
- *       11 10.452%
- *       15 4.806%
- *       17 2.348%
- *       21 1.656%
- *       29 1.281%
- *       27 0.6881%
- *       35 0.4536%
- *       39 0.3121%
- *       41 0.1760%
- *       31 0.1414%
- *       45 0.1173%
- *       51 0.05576%
- *       55 0.03300%
- *       49 0.03185%
- *       59 0.02090%
- *       69 0.00980%
- *       65 0.009367%
- *       71 0.007205%
- *       57 0.006341%
- *       85 0.004611%
- *       81 0.004179%
- *       95 0.002882%
- *       99 0.001873%
- *       77 0.001153%
- *       53 0.0007205%
- *       67 0.0005764%
- *      125 0.0005764%
- *      105 0.0005764%
- *       87 0.0004323%
- *      111 0.0004323%
- *      101 0.0002882%
- *       83 0.0001441%
- *      127 0.0001196%
- *
- * When h * 2^n-1 is prime and h is an odd multiple of 3, a smallest v(1) that
- * is even is extremely rate.  Of the list of 127287 known primes of the form
- * h*2^n-1 when h was a multiple of 3, none has an smallest v(1) that was even.
  *
- * About 1 out of 835000 cases when h is a multiple of 3 use v(1) > 127 as the
- * smallest value of v(1).
+ * For example for in a sample size of 1000000 numbers of the form h*2^n-1
+ * where h is an odd multiple of 3, 12996351 <= h <= 13002351,
+ * 4331116 <= n <= 4332116, these are the smallest v(1) values that were found:
+ *
+ *  smallest  percentage
+ *     v(1)     used
+ *  --------  ---------
+ *       3   40.0000 %
+ *       5   25.6833 %
+ *       9   11.6924 %
+ *      11   10.4528 %
+ *      15    4.8048 %
+ *      17    2.3458 %
+ *      21    1.3734 %
+ *      29    1.0527 %
+ *      20    0.8595 %
+ *      27    0.5758 %
+ *      35    0.4420 %
+ *      36    0.2433 %
+ *      39    0.1779 %
+ *      41    0.0885 %
+ *      45    0.0571 %
+ *      32    0.0337 %
+ *      51    0.0289 %
+ *      44    0.0205 %
+ *      49    0.0176 %
+ *      56    0.0137 %
+ *      59    0.0108 %
+ *      57    0.0053 %
+ *      65    0.0047 %
+ *      55    0.0045 %
+ *      69    0.0031 %
+ *      71    0.0024 %
+ *      66    0.0011 %
+ *      95    0.0008 %
+ *      81    0.0008 %
+ *      77    0.0006 %
+ *      72    0.0005 %
+ *      99    0.0004 %
+ *      80    0.0003 %
+ *      74    0.0003 %
+ *      84    0.0002 %
+ *      67    0.0002 %
+ *      87    0.0001 %
+ *     104    0.0001 %
+ *     129    0.0001 %
+ *
+ * However, a case can be made for considering only odd values for v(1)
+ * candidates.  When h * 2^n-1 is prime and h is an odd multiple of 3,
+ * a smallest v(1) that is even is extremely rate.  Of the list of 146553
+ * known primes of the form h*2^n-1 when h is an odd a multiple of 3,
+ * none has an smallest v(1) that was even.
+ *
+ * See:
+ *
+ *     https://github.com/arcetri/verified-prime
+ *
+ * for that list of 146553 known primes of the form h*2^n-1.
+ *
+ * That same example for in a sample size of 1000000 numbers of the
+ * form h*2^n-1 where h is an odd multiple of 3, 12996351 <= h <= 13002351,
+ * 4331116 <= n <= 4332116, these are the smallest odd v(1) values that were
+ * found:
+ *
+ *  smallest    percentage
+ *  odd v(1)       used
+ *  --------    ---------
+ *       3     40.0000 %
+ *       5     25.6833 %
+ *       9     11.6924 %
+ *      11     10.4528 %
+ *      15      4.8048 %
+ *      17      2.3458 %
+ *      21      1.6568 %
+ *      29      1.6174 %
+ *      35      0.4529 %
+ *      27      0.3546 %
+ *      39      0.3470 %
+ *      41      0.2159 %
+ *      45      0.1173 %
+ *      31      0.0661 %
+ *      51      0.0619 %
+ *      55      0.0419 %
+ *      59      0.0250 %
+ *      49      0.0170 %
+ *      69      0.0110 %
+ *      65      0.0098 %
+ *      71      0.0078 %
+ *      85      0.0048 %
+ *      81      0.0044 %
+ *      95      0.0038 %
+ *      99      0.0021 %
+ *     125      0.0009 %
+ *      57      0.0007 %
+ *     111      0.0005 %
+ *      77      0.0003 %
+ *     165      0.0003 %
+ *     155      0.0002 %
+ *     129      0.0002 %
+ *     101      0.0002 %
+ *      53      0.0001 %
+ *
+ * Moreover when evaluating odd candidates for v(1), one may cache Jacobi
+ * symbol evaluations to reduce the number of Jacobi symbol evaluations to
+ * a minimum. For example, if one tests 5 and finds that the 2nd case fails:
+ *
+ *     jacobi(5+2, h*2^n-1) != -1
+ *
+ * Then if one is later testing 9, the Jacobi symbol value for the first
+ * 1st case:
+ *
+ *     jacobi(7-2, h*2^n-1)
+ *
+ * is already known.
+ *
+ * Without Jacobi symbol value caching, it requires on average
+ * 4.851377 Jacobi symbol evaluations.  With Jacobi symbol value caching
+ * cacheing, an averare of 4.348820 Jacobi symbol evaluations is needed.
  *
  * Given this information, when odd h is a multiple of 3 we try, in order,
- * these sorted values of X:
+ * these odd values of X:
  *
- *      3, 5, 9, 11, 15, 17, 21, 27, 29, 31, 35, 39, 41, 45, 49, 51, 53, 55,
- *     57, 59, 65, 67, 69, 71, 77, 81, 83, 85, 87, 95, 99, 101, 105, 111, 125
+ *     3, 5, 9, 11, 15, 17, 21, 29, 27, 35, 39, 41, 31, 45, 51, 55, 49, 59,
+ *     69, 65, 71, 57, 85, 81, 95, 99, 77, 53, 67, 125, 111, 105, 87, 129,
+ *     101, 83, 165, 155, 149, 141, 121, 109
  *
  * And stop on the first value of X where:
  *
  *      jacobi(X-2, h*2^n-1) == 1
  *      jacobi(X+2, h*2^n-1) == -1
  *
- * If no value in that list works, we start simple search starting with X = 12/
+ * Less than 1 case out of 1000000 will not be satisifed by the above list.
+ * If no value in that list works, we start simple search starting with X = 167
  * and incrementing by 2 until a value of X is found.
  *
- * The x_tbl[] matrix contains those common values of X to try in order.
- * If all x_tbl_len fail to satisfy Ref4 condition 1, then we begin a
- * linear search at next_x until we find a proper X value.
+ * The x_tbl[] matrix contains those values of X to try in order.
+ * If all x_tbl_len fail to satisfy Ref4 condition 1 (this happens less than
+ * 1 in 1000000 cases), then we begin a linear search of odd values starting at
+ * next_x until we find a proper X value.
  */
-x_tbl_len = 35;
+x_tbl_len = 42;
 mat x_tbl[x_tbl_len];
 x_tbl = {
-    3, 5, 9, 11, 15, 17, 21, 27, 29, 31, 35, 39, 41, 45, 49, 51, 53, 55,
-    57, 59, 65, 67, 69, 71, 77, 81, 83, 85, 87, 95, 99, 101, 105, 111, 125
+    3, 5, 9, 11, 15, 17, 21, 29, 27, 35, 39, 41, 31, 45, 51, 55, 49, 59,
+    69, 65, 71, 57, 85, 81, 95, 99, 77, 53, 67, 125, 111, 105, 87, 129,
+    101, 83, 165, 155, 149, 141, 121, 109
 };
-next_x = 127;
+next_x = 167;  /* must be 2 more than the largest value in x_tbl[] */
 
 /*
  * gen_v1 - compute the v(1) for a given h*2^n-1 if we can
@@ -938,12 +1021,22 @@
  *
  *     u(2) = v(h)                              (NOTE: some call this u(2))
  *
- * so we simply return
+ * so we can always return
  *
  *     v(1) = alpha^1 + alpha^(-1)
  *          = (2+sqrt(3)) + (2-sqrt(3))
  *          = 4
  *
+ * In 40% of the cases when h is not a multiple of 3, 3 is a valid value
+ * for v(1).  We can test if 3 is a valid value for v(1) in this case:
+ *
+ *     if jacobi(1, h*2^n-1) == 1 and jacobi(5, h*2^n-1) == -1, then
+ *         v(1) = 3
+ *     else
+ *         v(1) = 4
+ *
+ * HOTE: The above "if then else" works only of h is not a multiple of 3.
+ *
  ***
  *
  * Case 2:     (h mod 3 == 0)
@@ -1039,13 +1132,18 @@
  *     n       n as in h*2^n-1 (must be >= 1)
  *
  * output:
- *     returns v(1), or -1 is there is no quick way
+ *     returns v(1), or
+ *             -1 when h*2^n-1 is a multiple of 3
  */
 define
 gen_v1(h, n)
 {
        local x;        /* potential v(1) to test */
        local i;        /* x_tbl index */
+       local v1m2;     /* X-2 1st case */
+       local v1p2;     /* X+2 2nd case */
+       local testval;  /* h*2^n-1 - value we are testing if prime */
+       local mat cached_v1[next_x];    /* cached Jacobi symbol values or 0 */
 
        /*
         * check arg types
@@ -1067,11 +1165,24 @@
        }
 
        /*
+        * pretest: Verify that h*2^n-1 is not a multiple of 3
+        */
+       if (((h % 3 == 1) && (n % 2 == 0)) || ((h % 3 == 2) && (n % 2 == 1))) {
+               /* no need to test h*2^n-1, it is not prime */
+               return -1;
+       }
+
+       /*
         * check for Case 1:      (h mod 3 != 0)
         */
        if (h % 3 != 0) {
-               /* v(1) is easy to compute */
-               return 4;
+               if (rodseth_xhn(3, h, n) == 1) {
+                       /* 40% of the time, 3 works when h mod 3 != 0 */
+                       return 3;
+               } else {
+                       /* otherwise 4 always works when h mod 3 != 0 */
+                       return 4;
+               }
        }
 
        /*
@@ -1079,6 +1190,11 @@
         */
 
        /*
+        * clear cache
+        */
+       matfill(cached_v1, 0);
+
+       /*
         * We will look for x that satisfies conditions in Ref4, condition 1:
         *
         *      jacobi(X-2, h*2^n-1) == 1               part 1
@@ -1089,26 +1205,51 @@
         *       to the next odd value, the now jacobi(X-2, h*2^n-1)
         *       does not need to be re-evaluted.
         */
+       testval = h*2^n-1;
        for (i=0; i < x_tbl_len; ++i) {
 
                /*
-                * test Ref4 condition 1:
+                * obtain the next test candidate
                 */
                x = x_tbl[i];
-               if (rodseth_xhn(x, h, n) == 1) {
 
-                       /*
-                        * found a x that satisfies Ref4 condition 1
-                        */
-                       ldebug("gen_v1", "h= " + str(h) + " n= " + str(n) +
-                               " v1= " + str(x) + " using tbl[ " +
-                               str(i) + " ]");
-                       return x;
+               /*
+                * Check x for condition 1 part 1
+                *
+                *      jacobi(x-2, h*2^n-1) == 1
+                */
+               v1m2 = x-2;
+               if (cached_v1[v1m2] == 0) {
+                       cached_v1[v1m2] = jacobi(v1m2, testval);
+               }
+               if (cached_v1[v1m2] != 1) {
+                       continue;
+               }
+
+               /*
+                * Check x for condition 1 part 2
+                *
+                *      jacobi(x+2, h*2^n-1) == -1
+                */
+               v1p2 = x+2;
+               if (cached_v1[v1p2] == 0) {
+                       cached_v1[v1p2] = jacobi(v1p2, testval);
                }
+               if (cached_v1[v1p2] != -1) {
+                       continue;
+               }
+
+               /*
+                * found a x that satisfies Ref4 condition 1
+                */
+               ldebug("gen_v1", "h= " + str(h) + " n= " + str(n) +
+                       " v1= " + str(x) + " using tbl[ " +
+                       str(i) + " ]");
+               return x;
        }
 
        /*
-        * We are in that rare case (about 1 in 835 000) where none of the
+        * We are in that rare case (less than 1 in 1 000 000) where none of the
         * common X values satisfy Ref4 condition 1.  We start a linear search
         * of odd vules at next_x from here on.
         */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/calc-2.12.6.1/calc.man new/calc-2.12.6.4/calc.man
--- old/calc-2.12.6.1/calc.man  2017-06-02 23:50:17.000000000 +0200
+++ new/calc-2.12.6.4/calc.man  2017-09-07 23:21:34.000000000 +0200
@@ -657,8 +657,8 @@
 .sp 1
 .in +5n
 .nf
-./myfile
-./myfile.cal
+\a./myfile
+\a./myfile.cal
 ${LIBDIR}/myfile
 ${LIBDIR}/myfile.cal
 ${CUSTOMCALDIR}/myfile
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/calc-2.12.6.1/custom/Makefile 
new/calc-2.12.6.4/custom/Makefile
--- old/calc-2.12.6.1/custom/Makefile   2017-06-15 01:22:17.000000000 +0200
+++ new/calc-2.12.6.4/custom/Makefile   2018-01-17 00:35:36.000000000 +0100
@@ -348,7 +348,7 @@
 
 # The default calc versions
 #
-VERSION= 2.12.6.1
+VERSION= 2.12.6.4
 
 # Names of shared libraries with versions
 #
@@ -628,16 +628,6 @@
 # DARWIN_ARCH= -arch ppc               # PPC binary
 # DARWIN_ARCH= -arch x86_64            # native 64-bit binary
 DARWIN_ARCH=                           # native binary
-#
-# Starting with El Capitan OS X 10.11, root by default could not
-# mkdir under system locations, so we now use the /usr/local tree.
-#
-OPTDIR:= /usr/local
-BINDIR:= /${OPTDIR}/bin
-LIBDIR:= /${OPTDIR}/lib
-CALC_SHAREDIR:= /${OPTDIR}/share
-CALC_INCDIR:= /${OPTDIR}/include
-SCRIPTDIR:= ${BINDIR}/cscript
 endif
 
 ##################
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/calc-2.12.6.1/custom/Makefile.head 
new/calc-2.12.6.4/custom/Makefile.head
--- old/calc-2.12.6.1/custom/Makefile.head      2017-06-06 06:19:21.000000000 
+0200
+++ new/calc-2.12.6.4/custom/Makefile.head      2017-10-03 05:38:35.000000000 
+0200
@@ -348,7 +348,7 @@
 
 # The default calc versions
 #
-VERSION= 2.12.6.1
+VERSION= 2.12.6.4
 
 # Names of shared libraries with versions
 #
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/calc-2.12.6.1/custom/Makefile.simple 
new/calc-2.12.6.4/custom/Makefile.simple
--- old/calc-2.12.6.1/custom/Makefile.simple    2017-06-15 01:23:02.000000000 
+0200
+++ new/calc-2.12.6.4/custom/Makefile.simple    2018-01-17 00:36:25.000000000 
+0100
@@ -333,7 +333,7 @@
 
 # The default calc versions
 #
-VERSION= 2.12.6.1
+VERSION= 2.12.6.4
 
 # Names of shared libraries with versions
 #
@@ -543,16 +543,6 @@
 # DARWIN_ARCH= -arch ppc               # PPC binary
 # DARWIN_ARCH= -arch x86_64            # native 64-bit binary
 DARWIN_ARCH=                           # native binary
-#
-# Starting with El Capitan OS X 10.11, root by default could not
-# mkdir under system locations, so we now use the /usr/local tree.
-#
-OPTDIR:= /usr/local
-BINDIR:= /${OPTDIR}/bin
-LIBDIR:= /${OPTDIR}/lib
-CALC_SHAREDIR:= /${OPTDIR}/share
-CALC_INCDIR:= /${OPTDIR}/include
-SCRIPTDIR:= ${BINDIR}/cscript
 endif
 
 ##################
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/calc-2.12.6.1/version.c new/calc-2.12.6.4/version.c
--- old/calc-2.12.6.1/version.c 2017-06-06 06:05:19.000000000 +0200
+++ new/calc-2.12.6.4/version.c 2017-09-07 03:28:48.000000000 +0200
@@ -45,7 +45,7 @@
 #define MAJOR_VER      2       /* major library version */
 #define MINOR_VER      12      /* minor library version */
 #define MAJOR_PATCH    6       /* major software level under library version */
-#define MINOR_PATCH    1       /* minor software level or 0 if not patched */
+#define MINOR_PATCH    4       /* minor software level or 0 if not patched */
 
 
 /*
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/calc-2.12.6.1/zfunc.c new/calc-2.12.6.4/zfunc.c
--- old/calc-2.12.6.1/zfunc.c   2017-06-02 23:50:17.000000000 +0200
+++ new/calc-2.12.6.4/zfunc.c   2017-09-07 02:40:33.000000000 +0200
@@ -1029,93 +1029,98 @@
                                needw = FALSE;
                        }
                        g = *a0 * w;
-                       if (h < BASEB) g &= (1 << h) - 1;
-                       else g &= BASE1;
-               }
-               else g = 1;
-          } else
-               g = (HALF) *a0 * w;
-               a = a0;
-               b = b0;
-               i = n;
-               if (g > 1) {                    /* a - g * b case */
-                       f = 0;
-                       while (i--) {
-                               f = (FULL) *a - g * *b++ - f;
-                               *a++ = (HALF) f;
-                               f >>= BASEB;
-                               f = -f & BASE1;
-                       }
-                       if (f) {
-                               i = m - n;
-                               while (i-- && f) {
-                                       f = *a - f;
-                                       *a++ = (HALF) f;
-                                       f >>= BASEB;
-                                       f = -f & BASE1;
-                               }
-                       }
-                       while (m && !*a0) { /* Removing trailing zeros */
-                               m--;
-                               a0++;
-                       }
-                       if (f) {                /* a - g * b < 0 */
-                               while (m > 1 && a0[m-1] == BASE1) m--;
-                               *a0 = - *a0;
-                               a = a0;
-                               i = m;
-                               while (--i) {
-                                       a++;
-                                       *a = ~*a;
-                               }
-                       }
-               } else {                                /* abs(a - b) case */
-                       while (i && *a++ == *b++) i--;
-                       q = n - i;
-                       if (m == n) {           /* a and b same length */
-                               if (i) {         /* a not equal to b */
-                                       while (m && a0[m-1] == b0[m-1]) m--;
-                                       if (a0[m-1] < b0[m-1]) {
-                                               /* Swapping since a < b */
-                                               a = a0;
-                                               a0 = b0;
-                                               b0 = a;
-                                               k = j;
-                                       }
-                                       a = a0 + q;
-                                       b = b0 + q;
-                                       i = m - q;
-                                       f = 0;
-                                       while (i--) {
-                                               f = (FULL) *a - *b++ - f;
-                                               *a++ = (HALF) f;
-                                               f >>= BASEB;
-                                               f = -f & BASE1;
-                                       }
-                               }
-                       } else {                /* a has more digits than b */
-                               a = a0 + q;
-                               b = b0 + q;
-                               i = n - q;
-                               f = 0;
-                               while (i--) {
-                                       f = (FULL) *a - *b++ - f;
-                                       *a++ = (HALF) f;
-                                       f >>= BASEB;
-                                       f = -f & BASE1;
-                               }
-                               if (f) { while (!*a) *a++ = BASE1;
-                                       (*a)--;
-                               }
-                       }
-                       a0 += q;
-                       m -= q;
-                       while (m && !*a0) { /* Removing trailing zeros */
-                               m--;
-                               a0++;
+                       if (h < BASEB) {
+                           g &= (1 << h) - 1;
+                       } else {
+                           g &= BASE1;
                        }
+               } else {
+                       g = 1;
                }
-               while (m && !a0[m-1]) m--;      /* Removing leading zeros */
+           } else {
+               g = (HALF) *a0 * w;
+           }
+           a = a0;
+           b = b0;
+           i = n;
+           if (g > 1) {                        /* a - g * b case */
+                   f = 0;
+                   while (i--) {
+                           f = (FULL) *a - g * *b++ - f;
+                           *a++ = (HALF) f;
+                           f >>= BASEB;
+                           f = -f & BASE1;
+                   }
+                   if (f) {
+                           i = m - n;
+                           while (i-- && f) {
+                                   f = *a - f;
+                                   *a++ = (HALF) f;
+                                   f >>= BASEB;
+                                   f = -f & BASE1;
+                           }
+                   }
+                   while (m && !*a0) { /* Removing trailing zeros */
+                           m--;
+                           a0++;
+                   }
+                   if (f) {            /* a - g * b < 0 */
+                           while (m > 1 && a0[m-1] == BASE1) m--;
+                           *a0 = - *a0;
+                           a = a0;
+                           i = m;
+                           while (--i) {
+                                   a++;
+                                   *a = ~*a;
+                           }
+                   }
+           } else {                            /* abs(a - b) case */
+                   while (i && *a++ == *b++) i--;
+                   q = n - i;
+                   if (m == n) {               /* a and b same length */
+                           if (i) {     /* a not equal to b */
+                                   while (m && a0[m-1] == b0[m-1]) m--;
+                                   if (a0[m-1] < b0[m-1]) {
+                                           /* Swapping since a < b */
+                                           a = a0;
+                                           a0 = b0;
+                                           b0 = a;
+                                           k = j;
+                                   }
+                                   a = a0 + q;
+                                   b = b0 + q;
+                                   i = m - q;
+                                   f = 0;
+                                   while (i--) {
+                                           f = (FULL) *a - *b++ - f;
+                                           *a++ = (HALF) f;
+                                           f >>= BASEB;
+                                           f = -f & BASE1;
+                                   }
+                           }
+                   } else {            /* a has more digits than b */
+                           a = a0 + q;
+                           b = b0 + q;
+                           i = n - q;
+                           f = 0;
+                           while (i--) {
+                                   f = (FULL) *a - *b++ - f;
+                                   *a++ = (HALF) f;
+                                   f >>= BASEB;
+                                   f = -f & BASE1;
+                           }
+                           if (f) { while (!*a) *a++ = BASE1;
+                                   (*a)--;
+                           }
+                   }
+                   a0 += q;
+                   m -= q;
+                   while (m && !*a0) { /* Removing trailing zeros */
+                           m--;
+                           a0++;
+                   }
+           }
+           while (m && !a0[m-1]) m--;  /* Removing leading zeros */
        }
        if (m == 1) {                           /* a has one digit */
                v = *a0;

++++++ checksum.sha-256 ++++++
--- /var/tmp/diff_new_pack.SjhoAR/_old  2018-01-20 11:27:29.678177845 +0100
+++ /var/tmp/diff_new_pack.SjhoAR/_new  2018-01-20 11:27:29.678177845 +0100
@@ -4,18 +4,6 @@
 #
 #      sha256sum filename
 #
-fa4802e364a287c1f074bbbe108effc9cf0a859e49e976d2e03c3ddb08b7bd50       
calc-2.12.5.0-12.src.rpm
-b7bb96b26d42ae40c8cb12f634db0a838f46e54fe9557d26f3097bf1adfcdab6       
calc-2.12.5.0-12.x86_64.rpm
-a0e7b47af38330f188970998c8e5039134dadf6f2e3f2c00d7efdae272a4338d       
calc-2.12.5.0.tar.bz2
-93c4ad46dfc77402d064308348f56a07f5b5200b4f51971c712e2bf310e3d6b4       
calc-2.12.5.2-12.src.rpm
-0d6a4d40073f2adc22a6bcbf140a2e1444a30df908b70acac5ae33c0ced52510       
calc-2.12.5.2-12.x86_64.rpm
-39f5fad54bdb18d8c05a8b43cd73af24b2797c56e3c9c19d4c198793b53797b6       
calc-2.12.5.2.tar.bz2
-e5e6be7672c61d8c5f5d99188bd41777f1087f007e02382fdfd1549d3f792e37       
calc-2.12.5.3-12.src.rpm
-ae18bcd1d50148a2b00a7e4947268f27aecae8994af2a2b93854ccd95ee0ae4b       
calc-2.12.5.3-12.x86_64.rpm
-0fcf60917efb10aab145f1180c278a3ab63d789aad6d5e5f066a4458b5f9b692       
calc-2.12.5.3.tar.bz2
-198070dc5a427a1eaa5835f3f0848d4df1376e6d96135c17b6e43498dd3aa0d3       
calc-2.12.5.4-12.src.rpm
-ac9e9cbd5a0ab3432f61e49d7f7924a6dcdd905cf04782971c79bfa11b6217d7       
calc-2.12.5.4-12.x86_64.rpm
-a776121efe49f3230a293e28682e52ff6d5f2f1896d3a9b474a51de8c890919e       
calc-2.12.5.4.tar.bz2
 753d90537c0cd0e99c68712b33bfd98ed7504e61b4259d81ba94ff783f86e84c       
calc-2.12.5.6-12.src.rpm
 d67c376f4b32d33580a29eb8b3c52b5987a15269db010f09f5bed31d0fab230a       
calc-2.12.5.6-12.x86_64.rpm
 76090203a96d35dd10103112a7ad612f4d9b0526b758f2f49ac5bef02ba7cb39       
calc-2.12.5.6.tar.bz2
@@ -25,17 +13,19 @@
 2982a89257af8066e13fadacd9d6bb880efbb3d1f3506bc0ce5d3c2f5739447e       
calc-2.12.6.1-12.src.rpm
 5efb924c6f34737af6c78d752ad37782943deca6e5ba1eb55598b7528a820642       
calc-2.12.6.1-12.x86_64.rpm
 6d3b9237b671e0970c432f5886d467c142b425c713ec3beffb6fd05b6195c4ef       
calc-2.12.6.1.tar.bz2
-a6461f0cea3cb107f97ea6cb585f47baca98610f3616ed7a5c3649750d14d08b       
calc-debuginfo-2.12.5.0-12.x86_64.rpm
-504d16412ed7c9b2f1122220b4187923bbb82615697c2af355ee3abad54b42ad       
calc-debuginfo-2.12.5.2-12.x86_64.rpm
-ac0aa872fc3f774d9c7e553f370d628ea98119041500326f3f67595ffd332874       
calc-debuginfo-2.12.5.3-12.x86_64.rpm
-4f6591a328b50bb10196e5dd6c5c0a0a929f5961a85f0aad79d1939a3723b7d8       
calc-debuginfo-2.12.5.4-12.x86_64.rpm
+e4cac89afb19621b8411c77618f470d3e293c8749bb05ecbc7d8858022d0fab9       
calc-2.12.6.3-12.src.rpm
+1df9a38bbb33e7d004d31caab28cc1f847c76d0902fd2fb79f7c541711054172       
calc-2.12.6.3-12.x86_64.rpm
+7e7eba580055e53e57cbe147e1955060b0374234ef9b3ec4f29f1cfd8b06a206       
calc-2.12.6.3.tar.bz2
+a3a78424ed678ccc8082de460daa99c44d19d6e2552f488a31245eed1a532a35       
calc-2.12.6.4-12.src.rpm
+a252b277fb7f437ad454b5d4e1ad65f34d31fad7df7ed21380d7ccf72be9d979       
calc-2.12.6.4-12.x86_64.rpm
+bbe27ca48eb315c1785333fcecf0c1ebbdc8a255507b1bf42e3abc751458cb07       
calc-2.12.6.4.tar.bz2
 befb1ef348704f0c4c0a5ebf55b57acf6fa75119e3c8c267379814980ae70e83       
calc-debuginfo-2.12.5.6-12.x86_64.rpm
 83c7f2728496692f19bab7c957ba9867ed436f5048d595883831b7fdf9db0d31       
calc-debuginfo-2.12.6.0-12.x86_64.rpm
 e9aac5102f90ec81f8a3ec0d476d6cd89dc44f43823cff4f9415b10e076e8791       
calc-debuginfo-2.12.6.1-12.x86_64.rpm
-e753c5737d2ad7123e15f0817605fe8760c2287bbf261347d0097ca43f24ed99       
calc-devel-2.12.5.0-12.x86_64.rpm
-ca58c8c45878d0b5534ad6bb1f5ce99974b14d349061de512f03f7a818e5c82f       
calc-devel-2.12.5.2-12.x86_64.rpm
-37aa0dea8ad0bb40fd90b5aea1559d83f1992f68f2d14c3379a46e3c85b3cc14       
calc-devel-2.12.5.3-12.x86_64.rpm
-8bc6c61645d67f4221ae7a9db2db5860bb2dc0f0a86a41dcc377b11df2816996       
calc-devel-2.12.5.4-12.x86_64.rpm
+6a76d9c3fa42c2ccbbcfbc0c6f65f55abb8b7726846950618b291393d8139fd9       
calc-debuginfo-2.12.6.3-12.x86_64.rpm
+395945a90220f9e0e76b934bfb513e774c8fbda6ed180961c1febd9c1cf94cf6       
calc-debuginfo-2.12.6.4-12.x86_64.rpm
 91949fd27a789eab99817d93d1e4f12424948bb4910f0a23755cab5fed2fb658       
calc-devel-2.12.5.6-12.x86_64.rpm
 e79286c4b40913bdac87759dc5bf50b616af68c6fbda3c53c7703d66e311b9fa       
calc-devel-2.12.6.0-12.x86_64.rpm
 97f16cf48b519285f6c8d10f64e56ac5aa4a50f7bfed82b57d2f711482c30930       
calc-devel-2.12.6.1-12.x86_64.rpm
+bc458c4bd50d5215ec2f6df01fb1f11e8270577f51c581d087fda42b68ebbcd3       
calc-devel-2.12.6.3-12.x86_64.rpm
+13e053525fcf8752a96ea306a3b7aa037a019afb224577916d7f7c9cee14a40c       
calc-devel-2.12.6.4-12.x86_64.rpm


Reply via email to