summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/mplibdir
diff options
context:
space:
mode:
authorLuigi Scarso <luigi.scarso@gmail.com>2019-01-06 18:57:01 +0000
committerLuigi Scarso <luigi.scarso@gmail.com>2019-01-06 18:57:01 +0000
commit0c14fd18747b9f6fbbecb75ba8beef6d449c460a (patch)
tree6c60915cf22ba35f9f4fff0048ebe3a6c073662d /Build/source/texk/web2c/mplibdir
parent2a4260012f7ef1890dd351aabe4befd60922d5a6 (diff)
luatex 1.09.2; r-mpost alias of mpost -restricted
git-svn-id: svn://tug.org/texlive/trunk@49614 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/mplibdir')
-rw-r--r--Build/source/texk/web2c/mplibdir/ChangeLog9
-rw-r--r--Build/source/texk/web2c/mplibdir/mp.w29
-rw-r--r--Build/source/texk/web2c/mplibdir/mpmathbinary.w2
-rw-r--r--Build/source/texk/web2c/mplibdir/mpmathdecimal.w2
-rw-r--r--Build/source/texk/web2c/mplibdir/mpost.w4
5 files changed, 37 insertions, 9 deletions
diff --git a/Build/source/texk/web2c/mplibdir/ChangeLog b/Build/source/texk/web2c/mplibdir/ChangeLog
index e2c7244ebf0..90cedb96783 100644
--- a/Build/source/texk/web2c/mplibdir/ChangeLog
+++ b/Build/source/texk/web2c/mplibdir/ChangeLog
@@ -1,3 +1,12 @@
+2019-01-06 Luigi Scarso <luigi.scarso@gmail.com>
+ * Added r-mpost as an alias for mpost --restricted
+
+
+2018-10-22 Luigi Scarso <luigi.scarso@gmail.com>
+ * Fixed a bug in cubic intersection in arbitrary precision math with low precision.
+ * Raised minimal precision to 2 for decimal and binary mode.
+ * Added 3 levels to the bisection algorithm for for cubic intersection.
+
2018-08-27 Luigi Scarso <luigi.scarso@gmail.com>
* separation of mpmathbinary from the the core
diff --git a/Build/source/texk/web2c/mplibdir/mp.w b/Build/source/texk/web2c/mplibdir/mp.w
index d52ad37ce8b..8afa03cd21c 100644
--- a/Build/source/texk/web2c/mplibdir/mp.w
+++ b/Build/source/texk/web2c/mplibdir/mp.w
@@ -756,7 +756,7 @@ defined.
@<Glob...@>=
integer bad; /* is some ``constant'' wrong? */
-@ Later on we will say `|if ( int_packets+17*int_increment>bistack_size )mp->bad=19;|',
+@ Later on we will say `|if ( int_packets+(17+3)*int_increment>bistack_size )mp->bad=19;|',
or something similar.
In case you are wondering about the non-consequtive values of |bad|: most
@@ -4797,7 +4797,7 @@ double mp_get_numeric_value (MP mp, const char *s, size_t l) {
mp_loop_data *s;
s = mp->loop_ptr;
while (s != NULL && sym != s->var)
- s = mp->loop_ptr->link;
+ s = s->link;
if (s != NULL && sym == s->var ){
mp_xfree (ss);
return number_to_double(s->old_value) ;
@@ -4857,7 +4857,7 @@ mp_knot mp_get_path_value (MP mp, const char *s, size_t l) {
char *ss = mp_xstrdup(mp,s);
if (ss) {
mp_sym sym = mp_id_lookup(mp,ss,l,false);
- if (sym != NULL) {
+ if (sym != NULL && sym->v.data.node != NULL) {
if (mp_type(sym->v.data.node) == mp_path_type) {
mp_xfree (ss);
return (mp_knot) sym->v.data.node->data.p;
@@ -15680,7 +15680,7 @@ mp->bisect_stack = xmalloc ((bistack_size + 1), sizeof (mp_number));
xfree (mp->bisect_stack);
@ @<Check the ``constant''...@>=
-if (int_packets + 17 * int_increment > bistack_size)
+if (int_packets + (17+2) * int_increment > bistack_size)
mp->bad = 19;
@ Computation of the min and max is a tedious but fairly fast sequence of
@@ -15769,11 +15769,28 @@ and |(pp,mp_link(pp))|, respectively.
@c
static void mp_cubic_intersection (MP mp, mp_knot p, mp_knot pp) {
mp_knot q, qq; /* |mp_link(p)|, |mp_link(pp)| */
+ mp_number x_two_t; /* increment bit precision by x bit */
mp->time_to_go = max_patience;
set_number_from_scaled (mp->max_t, 2);
+ new_number (x_two_t);
+ number_clone (x_two_t,two_t);
+ number_double(x_two_t); number_double(x_two_t); /* add x=3 bit of precision */
+ number_double(x_two_t);
@<Initialize for intersections at level zero@>;
CONTINUE:
while (1) {
+ /* When we are in arbitrary precision math, low precisions can */
+ /* lead to acces locations beyond the stack_size: in this case */
+ /* we say that there is no intersection.*/
+ if ( ((x_packet (mp->xy))+4)>bistack_size ||
+ ((u_packet (mp->uv))+4)>bistack_size ||
+ ((y_packet (mp->xy))+4)>bistack_size ||
+ ((v_packet (mp->uv))+4)>bistack_size ){
+ set_number_from_scaled (mp->cur_t, 1);
+ set_number_from_scaled (mp->cur_tt, 1);
+ goto NOT_FOUND;
+ }
+
if (number_to_scaled (mp->delx) - mp->tol <=
number_to_scaled (stack_max (x_packet (mp->xy))) - number_to_scaled (stack_min (u_packet (mp->uv))))
if (number_to_scaled (mp->delx) + mp->tol >=
@@ -15783,7 +15800,8 @@ CONTINUE:
if (number_to_scaled (mp->dely) + mp->tol >=
number_to_scaled (stack_min (y_packet (mp->xy))) - number_to_scaled (stack_max (v_packet (mp->uv)))) {
if (number_to_scaled (mp->cur_t) >= number_to_scaled (mp->max_t)) {
- if (number_equal(mp->max_t, two_t)) { /* we've done 17 bisections */
+ if (number_equal(mp->max_t, x_two_t)) { /* we've done 17+x bisections */
+ number_divide_int(mp->cur_t,1<<3);number_divide_int(mp->cur_tt,1<<3);
set_number_from_scaled (mp->cur_t, ((number_to_scaled (mp->cur_t) + 1)/2));
set_number_from_scaled (mp->cur_tt, ((number_to_scaled (mp->cur_tt) + 1)/2));
return;
@@ -15798,6 +15816,7 @@ CONTINUE:
if (mp->time_to_go > 0) {
decr (mp->time_to_go);
} else {
+ number_divide_int(mp->appr_t,1<<3);number_divide_int(mp->appr_tt,1<<3);
while (number_less (mp->appr_t, unity_t)) {
number_double(mp->appr_t);
number_double(mp->appr_tt);
diff --git a/Build/source/texk/web2c/mplibdir/mpmathbinary.w b/Build/source/texk/web2c/mplibdir/mpmathbinary.w
index c2f8535a05b..a4312c52cb2 100644
--- a/Build/source/texk/web2c/mplibdir/mpmathbinary.w
+++ b/Build/source/texk/web2c/mplibdir/mpmathbinary.w
@@ -289,7 +289,7 @@ void * mp_initialize_binary_math (MP mp) {
mpfr_set_d(math->precision_max.data.num, MAX_PRECISION, ROUNDING);
mp_new_number (mp, &math->precision_min, mp_scaled_type);
/* really should be |precision_bits_to_digits(MPFR_PREC_MIN)| but that produces a horrible number */
- mpfr_set_d(math->precision_min.data.num, 1.0 , ROUNDING);
+ mpfr_set_d(math->precision_min.data.num, 2.0 , ROUNDING);
/* here are the constants for |scaled| objects */
mp_new_number (mp, &math->epsilon_t, mp_scaled_type);
mpfr_set (math->epsilon_t.data.num, epsilon_mpfr_t, ROUNDING);
diff --git a/Build/source/texk/web2c/mplibdir/mpmathdecimal.w b/Build/source/texk/web2c/mplibdir/mpmathdecimal.w
index 54347cdf795..2ddc216470e 100644
--- a/Build/source/texk/web2c/mplibdir/mpmathdecimal.w
+++ b/Build/source/texk/web2c/mplibdir/mpmathdecimal.w
@@ -409,7 +409,7 @@ void * mp_initialize_decimal_math (MP mp) {
mp_new_number (mp, &math->precision_max, mp_scaled_type);
decNumberFromInt32(math->precision_max.data.num, DECNUMDIGITS);
mp_new_number (mp, &math->precision_min, mp_scaled_type);
- decNumberFromInt32(math->precision_min.data.num, 1);
+ decNumberFromInt32(math->precision_min.data.num, 2);
/* here are the constants for |scaled| objects */
mp_new_number (mp, &math->epsilon_t, mp_scaled_type);
decNumberCopy(math->epsilon_t.data.num, &epsilon_decNumber);
diff --git a/Build/source/texk/web2c/mplibdir/mpost.w b/Build/source/texk/web2c/mplibdir/mpost.w
index 43da635c3fc..0ce57955e88 100644
--- a/Build/source/texk/web2c/mplibdir/mpost.w
+++ b/Build/source/texk/web2c/mplibdir/mpost.w
@@ -1386,7 +1386,7 @@ main (int argc, char **argv)
options->print_found_names = (int)true;
{
const char *base = cleaned_invocation_name(argv[0]);
- if (FILESTRCASEEQ(base, "rmpost")){
+ if (FILESTRCASEEQ(base, "rmpost")||FILESTRCASEEQ(base, "r-mpost")){
base++;
restricted_mode = true;
}
@@ -1423,7 +1423,7 @@ main (int argc, char **argv)
kpse_set_program_enabled (kpse_mem_format, MAKE_TEX_FMT_BY_DEFAULT,
kpse_src_compile);
kpse_set_program_name(argv[0], user_progname);
- if (FILESTRCASEEQ(kpse_program_name, "rmpost"))
+ if (FILESTRCASEEQ(kpse_program_name, "rmpost")||FILESTRCASEEQ(kpse_program_name, "r-mpost"))
kpse_program_name++;
}
@= /*@@=nullpass@@*/ @>