diff options
author | Luigi Scarso <luigi.scarso@gmail.com> | 2024-05-01 17:04:18 +0000 |
---|---|---|
committer | Luigi Scarso <luigi.scarso@gmail.com> | 2024-05-01 17:04:18 +0000 |
commit | d00e6a5b8a8bc3c1d8f0b7dd522e06b60fdf8111 (patch) | |
tree | 08b81a236074f3cc81d03bf67b62d965e46676f6 /Build/source/texk/web2c | |
parent | 498fdabb5a2e7d5048c7adcc780821c8d04cdd0a (diff) |
Fixed Update |arc| and |t_tot| after |do_arc_test| has just returned |t|in mp_get_arc_time. Fixed a bug in n_arg for double and binary mode, where -0.0 was different form 0.0.
git-svn-id: svn://tug.org/texlive/trunk@71144 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c')
-rw-r--r-- | Build/source/texk/web2c/mplibdir/ChangeLog | 9 | ||||
-rw-r--r-- | Build/source/texk/web2c/mplibdir/mp.w | 14 | ||||
-rw-r--r-- | Build/source/texk/web2c/mplibdir/mpmathbinary.w | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/mplibdir/mpmathdouble.w | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/mplibdir/mpmathinterval.w | 8 |
5 files changed, 33 insertions, 9 deletions
diff --git a/Build/source/texk/web2c/mplibdir/ChangeLog b/Build/source/texk/web2c/mplibdir/ChangeLog index 1bce2fdae0d..2082cbf596b 100644 --- a/Build/source/texk/web2c/mplibdir/ChangeLog +++ b/Build/source/texk/web2c/mplibdir/ChangeLog @@ -1,3 +1,12 @@ +2024-05-01 Luigi Scarso <luigi.scarso@gmail.com> + * Fixed Update |arc| and |t_tot| after |do_arc_test| has just returned |t| + in mp_get_arc_time + +2024-03-18 Luigi Scarso <luigi.scarso@gmail.com> + * Fixed a bug in n_arg for double and binary mode, + where -0.0 was different form 0.0. + Work in progress for the interval mode. + 2024-02-16 Luigi Scarso <luigi.scarso@gmail.com> * Updated manual. MetaPost 2.1 diff --git a/Build/source/texk/web2c/mplibdir/mp.w b/Build/source/texk/web2c/mplibdir/mp.w index 25e9143f287..df12979e079 100644 --- a/Build/source/texk/web2c/mplibdir/mp.w +++ b/Build/source/texk/web2c/mplibdir/mp.w @@ -71,12 +71,12 @@ undergoes any modifications, so that it will be clear which version of @^extensions to \MP@> @^system dependencies@> -@d default_banner "This is MetaPost, Version 2.10" /* printed when \MP\ starts */ +@d default_banner "This is MetaPost, Version 2.11" /* printed when \MP\ starts */ @d true 1 @d false 0 @<Metapost version header@>= -#define metapost_version "2.10" +#define metapost_version "2.11" @ The external library header for \MP\ is |mplib.h|. It contains a few typedefs and the header defintions for the externally used @@ -10353,14 +10353,20 @@ if (number_positive(arc)) { new_number (v1); set_number_from_substraction (d1, arc0, arc); /* d1 = arc0 - arc */ - set_number_from_div (n1, arc, d1); /* n1 = (arc / d1) */ + if (number_greater (d1,arc)) { + set_number_to_zero(n1); /* n1 = 0 */ + } else { + set_number_from_div (n1, arc, d1); /* n1 = (arc / d1) */ + floor_scaled(n1); + } number_clone (n, n1); set_number_from_mul (n1, n1, d1); /* n1 = (n1 * d1) */ number_substract (arc, n1); /* arc = arc - n1 */ number_clone (d1, inf_t); /* reuse d1 */ number_clone (v1, n); /* v1 = n */ - number_add (v1, epsilon_t); /* v1 = n1+1 */ + + set_number_from_int(v1, number_to_int(v1)+1); /* v1 = n1+1 */ set_number_from_div (d1, d1, v1); /* |d1 = EL_GORDO / v1| */ if (number_greater (t_tot, d1)) { mp->arith_error = true; diff --git a/Build/source/texk/web2c/mplibdir/mpmathbinary.w b/Build/source/texk/web2c/mplibdir/mpmathbinary.w index 159fae019af..78e7c2bcc1c 100644 --- a/Build/source/texk/web2c/mplibdir/mpmathbinary.w +++ b/Build/source/texk/web2c/mplibdir/mpmathbinary.w @@ -149,7 +149,7 @@ static double precision_bits_to_digits (mpfr_prec_t i); @d mpfr_negative_p(a) (mpfr_sgn((a))<0) @d mpfr_positive_p(a) (mpfr_sgn((a))>0) -@d checkZero(dec) if (mpfr_zero_p(dec) && mpfr_negative_p(dec)) { +@d checkZero(dec) if (mpfr_zero_p(dec)) { mpfr_set_zero(dec,1); } @@ -1677,7 +1677,9 @@ void mp_init_randoms (MP mp, int seed) { @ @c void mp_binary_number_modulo (mp_number *a, mp_number b) { - mpfr_remainder (a->data.num, a->data.num, b.data.num, ROUNDING); + /* mpfr_remainder (a->data.num, a->data.num, b.data.num, ROUNDING);*/ + /* This is consistent with scaled mode */ + mpfr_fmod (a->data.num, a->data.num, b.data.num, ROUNDING); } @ To consume a random integer for the uniform generator, the program below will say `|next_unif_random|'. diff --git a/Build/source/texk/web2c/mplibdir/mpmathdouble.w b/Build/source/texk/web2c/mplibdir/mpmathdouble.w index cb14969365f..8f51439c26d 100644 --- a/Build/source/texk/web2c/mplibdir/mpmathdouble.w +++ b/Build/source/texk/web2c/mplibdir/mpmathdouble.w @@ -1172,6 +1172,11 @@ void mp_double_n_arg (MP mp, mp_number *ret, mp_number x_orig, mp_number y_orig) @<Handle undefined arg@>; } else { ret->type = mp_angle_type; + /* Consistency with the other numbersystems */ + if (x_orig.data.dval == -0.0) + x_orig.data.dval = 0.0; + if (y_orig.data.dval == -0.0) + y_orig.data.dval = 0.0; ret->data.dval = atan2 (y_orig.data.dval, x_orig.data.dval) * (180.0 / PI) * angle_multiplier; if (ret->data.dval == -0.0) ret->data.dval = 0.0; diff --git a/Build/source/texk/web2c/mplibdir/mpmathinterval.w b/Build/source/texk/web2c/mplibdir/mpmathinterval.w index 755e4dd328d..4412fd561d1 100644 --- a/Build/source/texk/web2c/mplibdir/mpmathinterval.w +++ b/Build/source/texk/web2c/mplibdir/mpmathinterval.w @@ -317,7 +317,9 @@ static int mpfi_remainder_1 (mpfi_t r, mpfi_t x, mpfr_t m) { mpfr_inits2(precision_bits, d, abs_m, rem_a, rem_b, zero, one, abs_m_1,(mpfr_ptr) 0); mpfr_sub(d, b, a, MPFR_RNDN); mpfr_abs(abs_m, m, MPFR_RNDN); - mpfr_remainder(rem_a, a, m, MPFR_RNDN); mpfr_remainder(rem_b, b, m, MPFR_RNDN); + /*mpfr_remainder(rem_a, a, m, MPFR_RNDN); mpfr_remainder(rem_b, b, m, MPFR_RNDN); */ + /* This is consistent with scaled mode */ + mpfr_fmod(rem_a, a, m, MPFR_RNDN); mpfr_fmod(rem_b, b, m, MPFR_RNDN); if (mpfr_less_p(d,abs_m) && mpfr_lessequal_p(rem_a,rem_b)) { /*return [a % m, b % m] */ ret_val= mpfi_interv_fr(r, rem_a, rem_b); @@ -1879,8 +1881,8 @@ void mp_interval_n_arg (MP mp, mp_number *ret, mp_number x_orig, mp_number y_ori ret->type = mp_angle_type; mpfi_set_si(oneeighty_angle, 180 * angle_multiplier); mpfi_div(oneeighty_angle, oneeighty_angle, PI_mpfi_t); - checkZero((mpfi_ptr)y_orig.data.num); - checkZero((mpfi_ptr)x_orig.data.num); + /*checkZero((mpfi_ptr)y_orig.data.num);*/ + /*checkZero((mpfi_ptr)x_orig.data.num);*/ mpfi_atan2(atan2val, y_orig.data.num, x_orig.data.num); mpfi_mul(ret->data.num, atan2val, oneeighty_angle); checkZero((mpfi_ptr)ret->data.num); |