texlive[71144] Build/source/texk/web2c/mplibdir: Fixed Update |arc|

commits+lscarso at tug.org commits+lscarso at tug.org
Wed May 1 19:04:19 CEST 2024


Revision: 71144
          https://tug.org/svn/texlive?view=revision&revision=71144
Author:   lscarso
Date:     2024-05-01 19:04:18 +0200 (Wed, 01 May 2024)
Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/mplibdir/ChangeLog
    trunk/Build/source/texk/web2c/mplibdir/mp.w
    trunk/Build/source/texk/web2c/mplibdir/mpmathbinary.w
    trunk/Build/source/texk/web2c/mplibdir/mpmathdouble.w
    trunk/Build/source/texk/web2c/mplibdir/mpmathinterval.w

Modified: trunk/Build/source/texk/web2c/mplibdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/mplibdir/ChangeLog	2024-05-01 01:03:47 UTC (rev 71143)
+++ trunk/Build/source/texk/web2c/mplibdir/ChangeLog	2024-05-01 17:04:18 UTC (rev 71144)
@@ -1,3 +1,12 @@
+2024-05-01   Luigi Scarso <luigi.scarso at 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 at 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 at gmail.com>
 	*  Updated manual. MetaPost 2.1
 

Modified: trunk/Build/source/texk/web2c/mplibdir/mp.w
===================================================================
--- trunk/Build/source/texk/web2c/mplibdir/mp.w	2024-05-01 01:03:47 UTC (rev 71143)
+++ trunk/Build/source/texk/web2c/mplibdir/mp.w	2024-05-01 17:04:18 UTC (rev 71144)
@@ -71,12 +71,12 @@
 @^extensions to \MP@>
 @^system dependencies@>
 
- at d default_banner "This is MetaPost, Version 2.10" /* printed when \MP\ starts */
+ at 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,7 +10353,12 @@
   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 */
@@ -10360,7 +10365,8 @@
 
   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;

Modified: trunk/Build/source/texk/web2c/mplibdir/mpmathbinary.w
===================================================================
--- trunk/Build/source/texk/web2c/mplibdir/mpmathbinary.w	2024-05-01 01:03:47 UTC (rev 71143)
+++ trunk/Build/source/texk/web2c/mplibdir/mpmathbinary.w	2024-05-01 17:04:18 UTC (rev 71144)
@@ -149,7 +149,7 @@
 
 @d mpfr_negative_p(a) (mpfr_sgn((a))<0)
 @d mpfr_positive_p(a) (mpfr_sgn((a))>0)
- at d checkZero(dec)  if (mpfr_zero_p(dec) && mpfr_negative_p(dec)) {
+ at d checkZero(dec)  if (mpfr_zero_p(dec)) {
      mpfr_set_zero(dec,1);
    }
 
@@ -1677,7 +1677,9 @@
 
 @ @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|'.

Modified: trunk/Build/source/texk/web2c/mplibdir/mpmathdouble.w
===================================================================
--- trunk/Build/source/texk/web2c/mplibdir/mpmathdouble.w	2024-05-01 01:03:47 UTC (rev 71143)
+++ trunk/Build/source/texk/web2c/mplibdir/mpmathdouble.w	2024-05-01 17:04:18 UTC (rev 71144)
@@ -1172,6 +1172,11 @@
     @<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;

Modified: trunk/Build/source/texk/web2c/mplibdir/mpmathinterval.w
===================================================================
--- trunk/Build/source/texk/web2c/mplibdir/mpmathinterval.w	2024-05-01 01:03:47 UTC (rev 71143)
+++ trunk/Build/source/texk/web2c/mplibdir/mpmathinterval.w	2024-05-01 17:04:18 UTC (rev 71144)
@@ -317,7 +317,9 @@
      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 @@
     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);



More information about the tex-live-commits mailing list.