Module Name: src
Committed By: mrg
Date: Mon Jul 1 02:25:07 UTC 2024
Modified Files:
src/external/lgpl3/mpfr/dist: VERSION
src/external/lgpl3/mpfr/dist/src: Makefile.in vasprintf.c
Log Message:
merge mpfr 4.2.1.
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/lgpl3/mpfr/dist/VERSION
cvs rdiff -u -r1.7 -r1.8 src/external/lgpl3/mpfr/dist/src/Makefile.in
cvs rdiff -u -r1.6 -r1.7 src/external/lgpl3/mpfr/dist/src/vasprintf.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/lgpl3/mpfr/dist/VERSION
diff -u src/external/lgpl3/mpfr/dist/VERSION:1.7 src/external/lgpl3/mpfr/dist/VERSION:1.8
--- src/external/lgpl3/mpfr/dist/VERSION:1.7 Sun Mar 5 22:11:12 2023
+++ src/external/lgpl3/mpfr/dist/VERSION Mon Jul 1 02:25:07 2024
@@ -1 +1 @@
-4.2.0
+4.2.1
Index: src/external/lgpl3/mpfr/dist/src/Makefile.in
diff -u src/external/lgpl3/mpfr/dist/src/Makefile.in:1.7 src/external/lgpl3/mpfr/dist/src/Makefile.in:1.8
--- src/external/lgpl3/mpfr/dist/src/Makefile.in:1.7 Sun Mar 5 22:11:12 2023
+++ src/external/lgpl3/mpfr/dist/src/Makefile.in Mon Jul 1 02:25:07 2024
@@ -617,7 +617,7 @@ libmpfr_la_LIBADD = @LIBOBJS@ $(am__appe
# 4.0.x 6:x:0
# 4.1.x 7:x:1
# 4.2.x 8:x:2
-libmpfr_la_LDFLAGS = $(MPFR_LDFLAGS) $(LIBMPFR_LDFLAGS) -version-info 8:0:2
+libmpfr_la_LDFLAGS = $(MPFR_LDFLAGS) $(LIBMPFR_LDFLAGS) -version-info 8:1:2
GET_PATCHES_SH = $(top_srcdir)/tools/get_patches.sh
PATCHES = $(top_srcdir)/PATCHES
Index: src/external/lgpl3/mpfr/dist/src/vasprintf.c
diff -u src/external/lgpl3/mpfr/dist/src/vasprintf.c:1.6 src/external/lgpl3/mpfr/dist/src/vasprintf.c:1.7
--- src/external/lgpl3/mpfr/dist/src/vasprintf.c:1.6 Sun Mar 5 22:11:12 2023
+++ src/external/lgpl3/mpfr/dist/src/vasprintf.c Mon Jul 1 02:25:07 2024
@@ -880,7 +880,7 @@ struct number_parts
enum pad_t pad_type; /* Padding type */
mpfr_intmax_t pad_size; /* Number of padding characters */
- char sign; /* Sign character */
+ char sign; /* Sign character ('-', '+', ' ', or '\0') */
char *prefix_ptr; /* Pointer to prefix part */
size_t prefix_size; /* Number of characters in *prefix_ptr */
@@ -1067,12 +1067,6 @@ regular_ab (struct number_parts *np, mpf
uppercase = spec.spec == 'A';
- /* sign */
- if (MPFR_IS_NEG (p))
- np->sign = '-';
- else if (spec.showsign || spec.space)
- np->sign = spec.showsign ? '+' : ' ';
-
if (spec.spec == 'a' || spec.spec == 'A')
/* prefix part */
{
@@ -1290,12 +1284,6 @@ regular_eg (struct number_parts *np, mpf
const int uppercase = spec.spec == 'E' || spec.spec == 'G';
- /* sign */
- if (MPFR_IS_NEG (p))
- np->sign = '-';
- else if (spec.showsign || spec.space)
- np->sign = spec.showsign ? '+' : ' ';
-
/* integral part */
np->ip_size = 1;
if (dec_info == NULL)
@@ -1425,12 +1413,6 @@ regular_fg (struct number_parts *np, mpf
and it should have been changed to 6 before the function call) */
MPFR_ASSERTD (spec.prec >= 0);
- /* sign */
- if (MPFR_IS_NEG (p))
- np->sign = '-';
- else if (spec.showsign || spec.space)
- np->sign = spec.showsign ? '+' : ' ';
-
if (MPFR_GET_EXP (p) <= 0)
/* 0 < |p| < 1 */
{
@@ -1725,8 +1707,7 @@ partition_number (struct number_parts *n
/* WARNING: left justification means right space padding */
np->pad_type = spec.left ? RIGHT : spec.pad == '0' ? LEADING_ZEROS : LEFT;
np->pad_size = 0;
- np->sign = '\0';
- np->prefix_ptr =NULL;
+ np->prefix_ptr = NULL;
np->prefix_size = 0;
np->thousands_sep = '\0';
np->ip_ptr = NULL;
@@ -1746,6 +1727,12 @@ partition_number (struct number_parts *n
uppercase = spec.spec == 'A' || spec.spec == 'E' || spec.spec == 'F'
|| spec.spec == 'G';
+ /* The sign/space rule is the same for all cases. */
+ np->sign =
+ MPFR_IS_NEG (p) ? '-' :
+ spec.showsign ? '+' :
+ spec.space ? ' ' : '\0';
+
if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (p)))
{
if (MPFR_IS_NAN (p))
@@ -1767,9 +1754,6 @@ partition_number (struct number_parts *n
with left spaces instead */
np->pad_type = LEFT;
- if (MPFR_IS_NEG (p))
- np->sign = '-';
-
np->ip_size = MPFR_INF_STRING_LENGTH;
str = (char *) mpfr_allocate_func (1 + np->ip_size);
strcpy (str, uppercase ? MPFR_INF_STRING_UC : MPFR_INF_STRING_LC);
@@ -1781,11 +1765,6 @@ partition_number (struct number_parts *n
/* note: for 'g' spec, zero is always displayed with 'f'-style with
precision spec.prec - 1 and the trailing zeros are removed unless
the flag '#' is used. */
- if (MPFR_IS_NEG (p))
- /* signed zero */
- np->sign = '-';
- else if (spec.showsign || spec.space)
- np->sign = spec.showsign ? '+' : ' ';
if (spec.spec == 'a' || spec.spec == 'A')
/* prefix part */
@@ -1849,9 +1828,6 @@ partition_number (struct number_parts *n
/* change to right justification padding with left spaces */
np->pad_type = LEFT;
- if (MPFR_IS_NEG (p))
- np->sign = '-';
-
np->ip_size = 3;
str = (char *) mpfr_allocate_func (1 + np->ip_size);
strcpy (str, uppercase ? "UBF" : "ubf");
@@ -1888,7 +1864,7 @@ partition_number (struct number_parts *n
precision T-1.
where T is the threshold computed below and X is the exponent
that would be displayed with style 'e' and precision T-1. */
- int threshold;
+ mpfr_intmax_t threshold;
mpfr_exp_t x, e, k;
struct decimal_info dec_info;
@@ -1920,9 +1896,15 @@ partition_number (struct number_parts *n
e = e <= 0 ? k : (e + 2) / 3 + (k <= 0 ? 0 : k);
MPFR_ASSERTD (e >= 1);
+ if (e > threshold)
+ e = threshold;
+
+ /* error if e does not fit in size_t (for mpfr_get_str) */
+ if (e > (size_t) -1)
+ goto error;
+
dec_info.str = mpfr_get_str (NULL, &dec_info.exp, 10,
- e < threshold ? e : threshold,
- p, spec.rnd_mode);
+ e, p, spec.rnd_mode);
register_string (np->sl, dec_info.str);
/* mpfr_get_str corresponds to a significand between 0.1 and 1,
whereas here we want a significand between 1 and 10. */
@@ -2030,7 +2012,7 @@ sprnt_fp (struct string_buffer *buf, mpf
if (np.pad_type == LEFT && np.pad_size != 0)
buffer_pad (buf, ' ', np.pad_size);
- /* sign character (may be '-', '+', or ' ') */
+ /* sign character (may be '-', '+', ' ', or '\0') */
if (np.sign)
buffer_pad (buf, np.sign, 1);