From 689aabd7ce016445d85c25b5c815b53a975e4f29 Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Fri, 21 Aug 2020 20:56:11 +0000 Subject: metapost: sync with the upstream git-svn-id: svn://tug.org/texlive/trunk@56147 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/mplibdir/ChangeLog | 7 +++++++ Build/source/texk/web2c/mplibdir/mp.w | 10 +++++++++- Build/source/texk/web2c/mplibdir/mpmathbinary.w | 4 ++-- Build/source/texk/web2c/mplibdir/mpmathdecimal.w | 4 ++-- 4 files changed, 20 insertions(+), 5 deletions(-) (limited to 'Build/source') diff --git a/Build/source/texk/web2c/mplibdir/ChangeLog b/Build/source/texk/web2c/mplibdir/ChangeLog index a03ed1ac9ec..d289ee5eb1c 100644 --- a/Build/source/texk/web2c/mplibdir/ChangeLog +++ b/Build/source/texk/web2c/mplibdir/ChangeLog @@ -1,3 +1,10 @@ +2020-08-21 Luigi Scarso + * Changed epsilon in binary and decimal mode from 1E-52 to + 2^-173 =~0.835E-52, so that mp_solve_rising_cubic now works as + expected. + * Fix @ + in mp_set_text_box when height and depth are both -inf. + 2020-02-18 Luigi Scarso * better mp_snprintf macro diff --git a/Build/source/texk/web2c/mplibdir/mp.w b/Build/source/texk/web2c/mplibdir/mp.w index 5f9f174172d..dcbd01b31ea 100644 --- a/Build/source/texk/web2c/mplibdir/mp.w +++ b/Build/source/texk/web2c/mplibdir/mp.w @@ -34468,8 +34468,12 @@ void mp_set_text_box (MP mp, mp_text_node p) { size_t k, kk; /* current character and character to stop at */ four_quarters cc; /* the |char_info| for the current character */ mp_number h, d; /* dimensions of the current character */ + mp_number minus_inf_t; /* check the -inf of height and depth */ new_number(h); new_number(d); + new_number(minus_inf_t); + number_clone(minus_inf_t, inf_t); + number_negate(minus_inf_t); set_number_to_zero(p->width); set_number_to_neg_inf(p->height); set_number_to_neg_inf(p->depth); @@ -34484,6 +34488,7 @@ void mp_set_text_box (MP mp, mp_text_node p) { @; free_number (h); free_number (d); + free_number (minus_inf_t); } @@ -34513,7 +34518,10 @@ void mp_set_text_box (MP mp, mp_text_node p) { overflow. @= -if (number_to_scaled(p->height) < -number_to_scaled(p->depth)) { +if (number_equal(p->height,p->depth) && number_equal(p->height,minus_inf_t)) { + set_number_to_zero(p->height); + set_number_to_zero(p->depth); +} else if (number_to_scaled(p->height) < -number_to_scaled(p->depth)) { set_number_to_zero(p->height); set_number_to_zero(p->depth); } diff --git a/Build/source/texk/web2c/mplibdir/mpmathbinary.w b/Build/source/texk/web2c/mplibdir/mpmathbinary.w index a4312c52cb2..159fae019af 100644 --- a/Build/source/texk/web2c/mplibdir/mpmathbinary.w +++ b/Build/source/texk/web2c/mplibdir/mpmathbinary.w @@ -216,7 +216,7 @@ void * mp_initialize_binary_math (MP mp); @d equation_threshold 0.001 @d tfm_warn_threshold 0.0625 @d warning_limit pow(2.0,52.0) /* this is a large value that can just be expressed without loss of precision */ -@d epsilon "1E-52" +@d epsilon pow(2.0,-173.0) /* almost "1E-52" */ @d epsilonf pow(2.0,-52.0) @d EL_GORDO "1E1000000" /* the largest value that \MP\ likes. */ @d one_third_EL_GORDO (EL_GORDO/3.0) @@ -255,7 +255,7 @@ void init_binary_constants (void) { mpfr_set_si (fraction_one_plus_mpfr_t, (fraction_one+1), ROUNDING); mpfr_set_si (angle_multiplier_mpfr_t, angle_multiplier, ROUNDING); mpfr_set_str (PI_mpfr_t, PI_STRING, 10, ROUNDING); - mpfr_set_str (epsilon_mpfr_t, epsilon, 10, ROUNDING); + mpfr_set_d(epsilon_mpfr_t, epsilon , ROUNDING); mpfr_set_str (EL_GORDO_mpfr_t, EL_GORDO, 10, ROUNDING); initialized = true; } diff --git a/Build/source/texk/web2c/mplibdir/mpmathdecimal.w b/Build/source/texk/web2c/mplibdir/mpmathdecimal.w index 2ddc216470e..5c2a8fe624e 100644 --- a/Build/source/texk/web2c/mplibdir/mpmathdecimal.w +++ b/Build/source/texk/web2c/mplibdir/mpmathdecimal.w @@ -346,7 +346,7 @@ void * mp_initialize_decimal_math (MP mp); @d p_over_v_threshold 0x80000 /* TODO */ @d equation_threshold 0.001 @d tfm_warn_threshold 0.0625 -@d epsilon "1E-52" +@d epsilon pow(2.0,-173.0) /* almost "1E-52" */ @d epsilonf pow(2.0,-52.0) @d EL_GORDO "1E1000000" /* the largest value that \MP\ likes. */ @d warning_limit "1E1000000" /* this is a large value that can just be expressed without loss of precision */ @@ -394,7 +394,7 @@ void * mp_initialize_decimal_math (MP mp) { decNumberFromInt32(&fraction_one_plus_decNumber, (fraction_one+1)); decNumberFromInt32(&angle_multiplier_decNumber, angle_multiplier); decNumberFromString(&PI_decNumber, PI_STRING, &set); - decNumberFromString(&epsilon_decNumber, epsilon, &set); + decNumberFromDouble(&epsilon_decNumber, epsilon); decNumberFromString(&EL_GORDO_decNumber, EL_GORDO, &set); factorials = (decNumber **)mp_xmalloc(mp,PRECALC_FACTORIALS_CACHESIZE,sizeof(decNumber *)); factorials[0] = (decNumber *)mp_xmalloc(mp,1,sizeof(decNumber)); -- cgit v1.2.3