source: patches/mpfr-3.1.3-fixes-1.patch @ e184030

systemd
Last change on this file since e184030 was e184030, checked in by William Harrington <kb0iic@…>, 9 years ago

Update MPFR to 3.1.3 from 3.1.2.

  • Property mode set to 100644
File size: 80.6 KB
RevLine 
[e184030]1Submitted By: William Harrington (kb0iic at cross-lfs dot org)
2Date: 2015-08-18
3Initial Package Version: 3.1.3
4Origin: Upstream
5Upstream Status: Applied
6Description: Contains all upstream patches of mpfr current to patch level 4.
7
8diff -Naurd mpfr-3.1.3-a/PATCHES mpfr-3.1.3-b/PATCHES
9--- mpfr-3.1.3-a/PATCHES        2015-07-02 10:49:23.950112879 +0000
10+++ mpfr-3.1.3-b/PATCHES        2015-07-02 10:49:24.042113845 +0000
11@@ -0,0 +1 @@
12+lngamma-and-doc
13diff -Naurd mpfr-3.1.3-a/VERSION mpfr-3.1.3-b/VERSION
14--- mpfr-3.1.3-a/VERSION        2015-06-19 19:55:09.000000000 +0000
15+++ mpfr-3.1.3-b/VERSION        2015-07-02 10:49:24.042113845 +0000
16@@ -1 +1 @@
17-3.1.3
18+3.1.3-p1
19diff -Naurd mpfr-3.1.3-a/doc/mpfr.texi mpfr-3.1.3-b/doc/mpfr.texi
20--- mpfr-3.1.3-a/doc/mpfr.texi  2015-06-19 19:55:11.000000000 +0000
21+++ mpfr-3.1.3-b/doc/mpfr.texi  2015-07-02 10:49:24.018113593 +0000
22@@ -810,13 +810,17 @@
23 When the input point is in the closure of the domain of the mathematical
24 function and an input argument is +0 (resp.@: @minus{}0), one considers
25 the limit when the corresponding argument approaches 0 from above
26-(resp.@: below). If the limit is not defined (e.g., @code{mpfr_log} on
27-@minus{}0), the behavior is specified in the description of the MPFR function.
28+(resp.@: below), if possible. If the limit is not defined (e.g.,
29+@code{mpfr_sqrt} and @code{mpfr_log} on @minus{}0), the behavior is
30+specified in the description of the MPFR function, but must be consistent
31+with the rule from the above paragraph (e.g., @code{mpfr_log} on @pom{}0
32+gives @minus{}Inf).
33 
34 When the result is equal to 0, its sign is determined by considering the
35 limit as if the input point were not in the domain: If one approaches 0
36 from above (resp.@: below), the result is +0 (resp.@: @minus{}0);
37-for example, @code{mpfr_sin} on +0 gives +0.
38+for example, @code{mpfr_sin} on @minus{}0 gives @minus{}0 and
39+@code{mpfr_acos} on 1 gives +0 (in all rounding modes).
40 In the other cases, the sign is specified in the description of the MPFR
41 function; for example @code{mpfr_max} on @minus{}0 and +0 gives +0.
42 
43@@ -832,8 +836,8 @@
44 @c that advantages in practice), like for any bug fix.
45 Example: @code{mpfr_hypot} on (NaN,0) gives NaN, but @code{mpfr_hypot}
46 on (NaN,+Inf) gives +Inf (as specified in @ref{Special Functions}),
47-since for any finite input @var{x}, @code{mpfr_hypot} on (@var{x},+Inf)
48-gives +Inf.
49+since for any finite or infinite input @var{x}, @code{mpfr_hypot} on
50+(@var{x},+Inf) gives +Inf.
51 
52 @node Exceptions, Memory Handling, Floating-Point Values on Special Numbers, MPFR Basics
53 @comment  node-name,  next,  previous,  up
54@@ -1581,7 +1585,8 @@
55 @deftypefunx int mpfr_add_z (mpfr_t @var{rop}, mpfr_t @var{op1}, mpz_t @var{op2}, mpfr_rnd_t @var{rnd})
56 @deftypefunx int mpfr_add_q (mpfr_t @var{rop}, mpfr_t @var{op1}, mpq_t @var{op2}, mpfr_rnd_t @var{rnd})
57 Set @var{rop} to @math{@var{op1} + @var{op2}} rounded in the direction
58-@var{rnd}. For types having no signed zero, it is considered unsigned
59+@var{rnd}.  The IEEE-754 rules are used, in particular for signed zeros.
60+But for types having no signed zeros, 0 is considered unsigned
61 (i.e., (+0) + 0 = (+0) and (@minus{}0) + 0 = (@minus{}0)).
62 The @code{mpfr_add_d} function assumes that the radix of the @code{double} type
63 is a power of 2, with a precision at most that declared by the C implementation
64@@ -1599,7 +1604,8 @@
65 @deftypefunx int mpfr_sub_z (mpfr_t @var{rop}, mpfr_t @var{op1}, mpz_t @var{op2}, mpfr_rnd_t @var{rnd})
66 @deftypefunx int mpfr_sub_q (mpfr_t @var{rop}, mpfr_t @var{op1}, mpq_t @var{op2}, mpfr_rnd_t @var{rnd})
67 Set @var{rop} to @math{@var{op1} - @var{op2}} rounded in the direction
68-@var{rnd}. For types having no signed zero, it is considered unsigned
69+@var{rnd}.  The IEEE-754 rules are used, in particular for signed zeros.
70+But for types having no signed zeros, 0 is considered unsigned
71 (i.e., (+0) @minus{} 0 = (+0), (@minus{}0) @minus{} 0 = (@minus{}0),
72 0 @minus{} (+0) = (@minus{}0) and 0 @minus{} (@minus{}0) = (+0)).
73 The same restrictions than for @code{mpfr_add_d} apply to @code{mpfr_d_sub}
74@@ -1615,7 +1621,7 @@
75 Set @var{rop} to @math{@var{op1} @GMPtimes{} @var{op2}} rounded in the
76 direction @var{rnd}.
77 When a result is zero, its sign is the product of the signs of the operands
78-(for types having no signed zero, it is considered positive).
79+(for types having no signed zeros, 0 is considered positive).
80 The same restrictions than for @code{mpfr_add_d} apply to @code{mpfr_mul_d}.
81 @end deftypefun
82 
83@@ -1635,7 +1641,7 @@
84 @deftypefunx int mpfr_div_q (mpfr_t @var{rop}, mpfr_t @var{op1}, mpq_t @var{op2}, mpfr_rnd_t @var{rnd})
85 Set @var{rop} to @math{@var{op1}/@var{op2}} rounded in the direction @var{rnd}.
86 When a result is zero, its sign is the product of the signs of the operands
87-(for types having no signed zero, it is considered positive).
88+(for types having no signed zeros, 0 is considered positive).
89 The same restrictions than for @code{mpfr_add_d} apply to @code{mpfr_d_div}
90 and @code{mpfr_div_d}.
91 @end deftypefun
92@@ -1643,15 +1649,18 @@
93 @deftypefun int mpfr_sqrt (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
94 @deftypefunx int mpfr_sqrt_ui (mpfr_t @var{rop}, unsigned long int @var{op}, mpfr_rnd_t @var{rnd})
95 Set @var{rop} to @m{\sqrt{@var{op}}, the square root of @var{op}}
96-rounded in the direction @var{rnd} (set @var{rop} to @minus{}0 if @var{op} is
97-@minus{}0, to be consistent with the IEEE 754 standard).
98+rounded in the direction @var{rnd}.  Set @var{rop} to @minus{}0 if
99+@var{op} is @minus{}0, to be consistent with the IEEE 754 standard.
100 Set @var{rop} to NaN if @var{op} is negative.
101 @end deftypefun
102 
103 @deftypefun int mpfr_rec_sqrt (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
104 Set @var{rop} to @m{1/\sqrt{@var{op}}, the reciprocal square root of @var{op}}
105-rounded in the direction @var{rnd}. Set @var{rop} to +Inf if @var{op} is
106-@pom{}0, +0 if @var{op} is +Inf, and NaN if @var{op} is negative.
107+rounded in the direction @var{rnd}.  Set @var{rop} to +Inf if @var{op} is
108+@pom{}0, +0 if @var{op} is +Inf, and NaN if @var{op} is negative.  Warning!
109+Therefore the result on @minus{}0 is different from the one of the rSqrt
110+function recommended by the IEEE 754-2008 standard (Section 9.2.1), which
111+is @minus{}Inf instead of +Inf.
112 @end deftypefun
113 
114 @deftypefun int mpfr_cbrt (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
115@@ -1832,7 +1841,9 @@
116 @m{\log_2 @var{op}, log2(@var{op})} or
117 @m{\log_{10} @var{op}, log10(@var{op})}, respectively,
118 rounded in the direction @var{rnd}.
119-Set @var{rop} to @minus{}Inf if @var{op} is @minus{}0
120+Set @var{rop} to +0 if @var{op} is 1 (in all rounding modes),
121+for consistency with the ISO C99 and IEEE 754-2008 standards.
122+Set @var{rop} to @minus{}Inf if @var{op} is @pom{}0
123 (i.e., the sign of the zero has no influence on the result).
124 @end deftypefun
125 
126@@ -2003,8 +2014,11 @@
127 @deftypefun int mpfr_lngamma (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
128 Set @var{rop} to the value of the logarithm of the Gamma function on @var{op},
129 rounded in the direction @var{rnd}.
130-When @math{@minus{}2@var{k}@minus{}1 @le{} @var{op} @le{} @minus{}2@var{k}},
131-@var{k} being a non-negative integer, @var{rop} is set to NaN.
132+When @var{op} is 1 or 2, set @var{rop} to +0 (in all rounding modes).
133+When @var{op} is an infinity or a nonpositive integer, set @var{rop} to +Inf,
134+following the general rules on special values.
135+When @math{@minus{}2@var{k}@minus{}1 < @var{op} < @minus{}2@var{k}},
136+@var{k} being a nonnegative integer, set @var{rop} to NaN@.
137 See also @code{mpfr_lgamma}.
138 @end deftypefun
139 
140@@ -2012,10 +2026,11 @@
141 Set @var{rop} to the value of the logarithm of the absolute value of the
142 Gamma function on @var{op}, rounded in the direction @var{rnd}. The sign
143 (1 or @minus{}1) of Gamma(@var{op}) is returned in the object pointed to
144-by @var{signp}. When @var{op} is an infinity or a non-positive integer, set
145-@var{rop} to +Inf. When @var{op} is NaN, @minus{}Inf or a negative integer,
146-*@var{signp} is undefined, and when @var{op} is @pom{}0, *@var{signp} is
147-the sign of the zero.
148+by @var{signp}.
149+When @var{op} is 1 or 2, set @var{rop} to +0 (in all rounding modes).
150+When @var{op} is an infinity or a nonpositive integer, set @var{rop} to +Inf.
151+When @var{op} is NaN, @minus{}Inf or a negative integer, *@var{signp} is
152+undefined, and when @var{op} is @pom{}0, *@var{signp} is the sign of the zero.
153 @end deftypefun
154 
155 @deftypefun int mpfr_digamma (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
156@@ -2064,7 +2079,10 @@
157 @deftypefunx int mpfr_fms (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_t @var{op3}, mpfr_rnd_t @var{rnd})
158 Set @var{rop} to @math{(@var{op1} @GMPtimes{} @var{op2}) + @var{op3}}
159 (resp.@: @math{(@var{op1} @GMPtimes{} @var{op2}) - @var{op3}})
160-rounded in the direction @var{rnd}.
161+rounded in the direction @var{rnd}.  Concerning special values (signed zeros,
162+infinities, NaN), these functions behave like a multiplication followed by a
163+separate addition or subtraction.  That is, the fused operation matters only
164+for rounding.
165 @end deftypefun
166 
167 @deftypefun int mpfr_agm (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
168@@ -2089,8 +2107,8 @@
169 i.e., $\sqrt{x^2+y^2}$,
170 @end tex
171 rounded in the direction @var{rnd}.
172-Special values are handled as described in Section F.9.4.3 of
173-the ISO C99 and IEEE 754-2008 standards:
174+Special values are handled as described in the ISO C99 (Section F.9.4.3)
175+and IEEE 754-2008 (Section 9.2.1) standards:
176 If @var{x} or @var{y} is an infinity, then +Inf is returned in @var{rop},
177 even if the other number is NaN.
178 @end deftypefun
179diff -Naurd mpfr-3.1.3-a/doc/mpfr.info mpfr-3.1.3-b/doc/mpfr.info
180--- mpfr-3.1.3-a/doc/mpfr.info  2015-06-19 19:55:53.000000000 +0000
181+++ mpfr-3.1.3-b/doc/mpfr.info  2015-07-02 10:49:38.718267817 +0000
182@@ -1,4 +1,4 @@
183-This is mpfr.info, produced by makeinfo version 5.2 from mpfr.texi.
184+This is mpfr.info, produced by makeinfo version 6.0 from mpfr.texi.
185 
186 This manual documents how to install and use the Multiple Precision
187 Floating-Point Reliable Library, version 3.1.3.
188@@ -55,7 +55,7 @@
189 MPFR Copying Conditions
190 ***********************
191 
192-The GNU MPFR library (or MPFR for short) is "free"; this means that
193+The GNU MPFR library (or MPFR for short) is “free”; this means that
194 everyone is free to use it and free to redistribute it on a free basis.
195 The library is not in the public domain; it is copyrighted and there are
196 restrictions on its distribution, but these restrictions are designed to
197@@ -418,7 +418,7 @@
198 4.2 Nomenclature and Types
199 ==========================
200 
201-A "floating-point number", or "float" for short, is an arbitrary
202+A “floating-point number”, or “float” for short, is an arbitrary
203 precision significand (also called mantissa) with a limited precision
204 exponent.  The C data type for such objects is ‘mpfr_t’ (internally
205 defined as a one-element array of a structure, and ‘mpfr_ptr’ is the C
206@@ -432,7 +432,7 @@
207 to the other functions supported by MPFR. Unless documented otherwise,
208 the sign bit of a NaN is unspecified.
209 
210-The "precision" is the number of bits used to represent the significand
211+The “precision” is the number of bits used to represent the significand
212 of a floating-point number; the corresponding C data type is
213 â€˜mpfr_prec_t’.  The precision can be any integer between ‘MPFR_PREC_MIN’
214 and ‘MPFR_PREC_MAX’.  In the current implementation, ‘MPFR_PREC_MIN’ is
215@@ -446,7 +446,7 @@
216 may abort, crash or have undefined behavior (depending on your C
217 implementation).
218 
219-The "rounding mode" specifies the way to round the result of a
220+The “rounding mode” specifies the way to round the result of a
221 floating-point operation, in case the exact result can not be
222 represented exactly in the destination significand; the corresponding C
223 data type is ‘mpfr_rnd_t’.
224@@ -499,14 +499,14 @@
225 representable numbers, it is rounded to the one with the least
226 significant bit set to zero.  For example, the number 2.5, which is
227 represented by (10.1) in binary, is rounded to (10.0)=2 with a precision
228-of two bits, and not to (11.0)=3.  This rule avoids the "drift"
229+of two bits, and not to (11.0)=3.  This rule avoids the “drift”
230 phenomenon mentioned by Knuth in volume 2 of The Art of Computer
231 Programming (Section 4.2.2).
232 
233    Most MPFR functions take as first argument the destination variable,
234 as second and following arguments the input variables, as last argument
235 a rounding mode, and have a return value of type ‘int’, called the
236-"ternary value".  The value stored in the destination variable is
237+“ternary value”.  The value stored in the destination variable is
238 correctly rounded, i.e., MPFR behaves as if it computed the result with
239 an infinite precision, then rounded it to the precision of this
240 variable.  The input variables are regarded as exact (in particular,
241@@ -572,15 +572,18 @@
242    When the input point is in the closure of the domain of the
243 mathematical function and an input argument is +0 (resp. −0), one
244 considers the limit when the corresponding argument approaches 0 from
245-above (resp. below).  If the limit is not defined (e.g., ‘mpfr_log’ on
246-−0), the behavior is specified in the description of the MPFR function.
247+above (resp. below), if possible.  If the limit is not defined (e.g.,
248+‘mpfr_sqrt’ and ‘mpfr_log’ on −0), the behavior is specified in the
249+description of the MPFR function, but must be consistent with the rule
250+from the above paragraph (e.g., ‘mpfr_log’ on ±0 gives −Inf).
251 
252    When the result is equal to 0, its sign is determined by considering
253 the limit as if the input point were not in the domain: If one
254 approaches 0 from above (resp. below), the result is +0 (resp. −0); for
255-example, ‘mpfr_sin’ on +0 gives +0.  In the other cases, the sign is
256-specified in the description of the MPFR function; for example
257-‘mpfr_max’ on −0 and +0 gives +0.
258+example, ‘mpfr_sin’ on −0 gives −0 and ‘mpfr_acos’ on 1 gives +0 (in all
259+rounding modes).  In the other cases, the sign is specified in the
260+description of the MPFR function; for example ‘mpfr_max’ on −0 and +0
261+gives +0.
262 
263    When the input point is not in the closure of the domain of the
264 function, the result is NaN. Example: ‘mpfr_sqrt’ on −17 gives NaN.
265@@ -590,8 +593,8 @@
266 numbers; such a case is always explicitly specified in *note MPFR
267 Interface::.  Example: ‘mpfr_hypot’ on (NaN,0) gives NaN, but
268 â€˜mpfr_hypot’ on (NaN,+Inf) gives +Inf (as specified in *note Special
269-Functions::), since for any finite input X, ‘mpfr_hypot’ on (X,+Inf)
270-gives +Inf.
271+Functions::), since for any finite or infinite input X, ‘mpfr_hypot’ on
272+(X,+Inf) gives +Inf.
273 
274 
275 File: mpfr.info,  Node: Exceptions,  Next: Memory Handling,  Prev: Floating-Point Values on Special Numbers,  Up: MPFR Basics
276@@ -1253,8 +1256,9 @@
277           mpfr_rnd_t RND)
278  -- Function: int mpfr_add_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
279           mpfr_rnd_t RND)
280-     Set ROP to OP1 + OP2 rounded in the direction RND.  For types
281-     having no signed zero, it is considered unsigned (i.e., (+0) + 0 =
282+     Set ROP to OP1 + OP2 rounded in the direction RND.  The IEEE-754
283+     rules are used, in particular for signed zeros.  But for types
284+     having no signed zeros, 0 is considered unsigned (i.e., (+0) + 0 =
285      (+0) and (−0) + 0 = (−0)).  The ‘mpfr_add_d’ function assumes that
286      the radix of the ‘double’ type is a power of 2, with a precision at
287      most that declared by the C implementation (macro
288@@ -1280,8 +1284,9 @@
289           mpfr_rnd_t RND)
290  -- Function: int mpfr_sub_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
291           mpfr_rnd_t RND)
292-     Set ROP to OP1 - OP2 rounded in the direction RND.  For types
293-     having no signed zero, it is considered unsigned (i.e., (+0) − 0 =
294+     Set ROP to OP1 - OP2 rounded in the direction RND.  The IEEE-754
295+     rules are used, in particular for signed zeros.  But for types
296+     having no signed zeros, 0 is considered unsigned (i.e., (+0) − 0 =
297      (+0), (−0) − 0 = (−0), 0 − (+0) = (−0) and 0 − (−0) = (+0)).  The
298      same restrictions than for ‘mpfr_add_d’ apply to ‘mpfr_d_sub’ and
299      ‘mpfr_sub_d’.
300@@ -1300,7 +1305,7 @@
301           mpfr_rnd_t RND)
302      Set ROP to OP1 times OP2 rounded in the direction RND.  When a
303      result is zero, its sign is the product of the signs of the
304-     operands (for types having no signed zero, it is considered
305+     operands (for types having no signed zeros, 0 is considered
306      positive).  The same restrictions than for ‘mpfr_add_d’ apply to
307      ‘mpfr_mul_d’.
308 
309@@ -1327,21 +1332,24 @@
310           mpfr_rnd_t RND)
311      Set ROP to OP1/OP2 rounded in the direction RND.  When a result is
312      zero, its sign is the product of the signs of the operands (for
313-     types having no signed zero, it is considered positive).  The same
314+     types having no signed zeros, 0 is considered positive).  The same
315      restrictions than for ‘mpfr_add_d’ apply to ‘mpfr_d_div’ and
316      ‘mpfr_div_d’.
317 
318  -- Function: int mpfr_sqrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
319  -- Function: int mpfr_sqrt_ui (mpfr_t ROP, unsigned long int OP,
320           mpfr_rnd_t RND)
321-     Set ROP to the square root of OP rounded in the direction RND (set
322-     ROP to −0 if OP is −0, to be consistent with the IEEE 754
323-     standard).  Set ROP to NaN if OP is negative.
324+     Set ROP to the square root of OP rounded in the direction RND.  Set
325+     ROP to −0 if OP is −0, to be consistent with the IEEE 754 standard.
326+     Set ROP to NaN if OP is negative.
327 
328  -- Function: int mpfr_rec_sqrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
329      Set ROP to the reciprocal square root of OP rounded in the
330      direction RND.  Set ROP to +Inf if OP is ±0, +0 if OP is +Inf, and
331-     NaN if OP is negative.
332+     NaN if OP is negative.  Warning!  Therefore the result on −0 is
333+     different from the one of the rSqrt function recommended by the
334+     IEEE 754-2008 standard (Section 9.2.1), which is −Inf instead of
335+     +Inf.
336 
337  -- Function: int mpfr_cbrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
338  -- Function: int mpfr_root (mpfr_t ROP, mpfr_t OP, unsigned long int K,
339@@ -1515,8 +1523,10 @@
340  -- Function: int mpfr_log2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
341  -- Function: int mpfr_log10 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
342      Set ROP to the natural logarithm of OP, log2(OP) or log10(OP),
343-     respectively, rounded in the direction RND.  Set ROP to −Inf if OP
344-     is −0 (i.e., the sign of the zero has no influence on the result).
345+     respectively, rounded in the direction RND.  Set ROP to +0 if OP is
346+     1 (in all rounding modes), for consistency with the ISO C99 and
347+     IEEE 754-2008 standards.  Set ROP to −Inf if OP is ±0 (i.e., the
348+     sign of the zero has no influence on the result).
349 
350  -- Function: int mpfr_exp (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
351  -- Function: int mpfr_exp2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
352@@ -1649,17 +1659,21 @@
353 
354  -- Function: int mpfr_lngamma (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
355      Set ROP to the value of the logarithm of the Gamma function on OP,
356-     rounded in the direction RND.  When −2K−1 <= OP <= −2K, K being a
357-     non-negative integer, ROP is set to NaN. See also ‘mpfr_lgamma’.
358+     rounded in the direction RND.  When OP is 1 or 2, set ROP to +0 (in
359+     all rounding modes).  When OP is an infinity or a nonpositive
360+     integer, set ROP to +Inf, following the general rules on special
361+     values.  When −2K−1 < OP < −2K, K being a nonnegative integer, set
362+     ROP to NaN.  See also ‘mpfr_lgamma’.
363 
364  -- Function: int mpfr_lgamma (mpfr_t ROP, int *SIGNP, mpfr_t OP,
365           mpfr_rnd_t RND)
366      Set ROP to the value of the logarithm of the absolute value of the
367      Gamma function on OP, rounded in the direction RND.  The sign (1 or
368      −1) of Gamma(OP) is returned in the object pointed to by SIGNP.
369-     When OP is an infinity or a non-positive integer, set ROP to +Inf.
370-     When OP is NaN, −Inf or a negative integer, *SIGNP is undefined,
371-     and when OP is ±0, *SIGNP is the sign of the zero.
372+     When OP is 1 or 2, set ROP to +0 (in all rounding modes).  When OP
373+     is an infinity or a nonpositive integer, set ROP to +Inf.  When OP
374+     is NaN, −Inf or a negative integer, *SIGNP is undefined, and when
375+     OP is ±0, *SIGNP is the sign of the zero.
376 
377  -- Function: int mpfr_digamma (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
378      Set ROP to the value of the Digamma (sometimes also called Psi)
379@@ -1703,7 +1717,10 @@
380  -- Function: int mpfr_fms (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_t
381           OP3, mpfr_rnd_t RND)
382      Set ROP to (OP1 times OP2) + OP3 (resp. (OP1 times OP2) - OP3)
383-     rounded in the direction RND.
384+     rounded in the direction RND.  Concerning special values (signed
385+     zeros, infinities, NaN), these functions behave like a
386+     multiplication followed by a separate addition or subtraction.
387+     That is, the fused operation matters only for rounding.
388 
389  -- Function: int mpfr_agm (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
390           mpfr_rnd_t RND)
391@@ -1717,9 +1734,10 @@
392           RND)
393      Set ROP to the Euclidean norm of X and Y, i.e., the square root of
394      the sum of the squares of X and Y, rounded in the direction RND.
395-     Special values are handled as described in Section F.9.4.3 of the
396-     ISO C99 and IEEE 754-2008 standards: If X or Y is an infinity, then
397-     +Inf is returned in ROP, even if the other number is NaN.
398+     Special values are handled as described in the ISO C99 (Section
399+     F.9.4.3) and IEEE 754-2008 (Section 9.2.1) standards: If X or Y is
400+     an infinity, then +Inf is returned in ROP, even if the other number
401+     is NaN.
402 
403  -- Function: int mpfr_ai (mpfr_t ROP, mpfr_t X, mpfr_rnd_t RND)
404      Set ROP to the value of the Airy function Ai on X, rounded in the
405@@ -2670,7 +2688,7 @@
406 5.16 Internals
407 ==============
408 
409-A "limb" means the part of a multi-precision number that fits in a
410+A “limb” means the part of a multi-precision number that fits in a
411 single word.  Usually a limb contains 32 or 64 bits.  The C data type
412 for a limb is ‘mp_limb_t’.
413 
414@@ -3140,7 +3158,7 @@
415   0. PREAMBLE
416 
417      The purpose of this License is to make a manual, textbook, or other
418-     functional and useful document "free" in the sense of freedom: to
419+     functional and useful document “free” in the sense of freedom: to
420      assure everyone the effective freedom to copy and redistribute it,
421      with or without modifying it, either commercially or
422      noncommercially.  Secondarily, this License preserves for the
423@@ -3655,9 +3673,9 @@
424 * Menu:
425 
426 * mpfr_abs:                              Basic Arithmetic Functions.
427-                                                              (line 160)
428-* mpfr_acos:                             Special Functions.   (line  51)
429-* mpfr_acosh:                            Special Functions.   (line 115)
430+                                                              (line 165)
431+* mpfr_acos:                             Special Functions.   (line  53)
432+* mpfr_acosh:                            Special Functions.   (line 117)
433 * mpfr_add:                              Basic Arithmetic Functions.
434                                                               (line   6)
435 * mpfr_add_d:                            Basic Arithmetic Functions.
436@@ -3670,15 +3688,15 @@
437                                                               (line   8)
438 * mpfr_add_z:                            Basic Arithmetic Functions.
439                                                               (line  14)
440-* mpfr_agm:                              Special Functions.   (line 210)
441-* mpfr_ai:                               Special Functions.   (line 226)
442-* mpfr_asin:                             Special Functions.   (line  52)
443-* mpfr_asinh:                            Special Functions.   (line 116)
444+* mpfr_agm:                              Special Functions.   (line 219)
445+* mpfr_ai:                               Special Functions.   (line 236)
446+* mpfr_asin:                             Special Functions.   (line  54)
447+* mpfr_asinh:                            Special Functions.   (line 118)
448 * mpfr_asprintf:                         Formatted Output Functions.
449                                                               (line 193)
450-* mpfr_atan:                             Special Functions.   (line  53)
451-* mpfr_atan2:                            Special Functions.   (line  63)
452-* mpfr_atanh:                            Special Functions.   (line 117)
453+* mpfr_atan:                             Special Functions.   (line  55)
454+* mpfr_atan2:                            Special Functions.   (line  65)
455+* mpfr_atanh:                            Special Functions.   (line 119)
456 * mpfr_buildopt_decimal_p:               Miscellaneous Functions.
457                                                               (line 162)
458 * mpfr_buildopt_gmpinternals_p:          Miscellaneous Functions.
459@@ -3690,7 +3708,7 @@
460 * mpfr_can_round:                        Rounding Related Functions.
461                                                               (line  39)
462 * mpfr_cbrt:                             Basic Arithmetic Functions.
463-                                                              (line 108)
464+                                                              (line 113)
465 * mpfr_ceil:                             Integer Related Functions.
466                                                               (line   7)
467 * mpfr_check_range:                      Exception Related Functions.
468@@ -3735,18 +3753,18 @@
469                                                               (line  27)
470 * mpfr_cmp_z:                            Comparison Functions.
471                                                               (line  11)
472-* mpfr_const_catalan:                    Special Functions.   (line 237)
473-* mpfr_const_euler:                      Special Functions.   (line 236)
474-* mpfr_const_log2:                       Special Functions.   (line 234)
475-* mpfr_const_pi:                         Special Functions.   (line 235)
476+* mpfr_const_catalan:                    Special Functions.   (line 247)
477+* mpfr_const_euler:                      Special Functions.   (line 246)
478+* mpfr_const_log2:                       Special Functions.   (line 244)
479+* mpfr_const_pi:                         Special Functions.   (line 245)
480 * mpfr_copysign:                         Miscellaneous Functions.
481                                                               (line 109)
482-* mpfr_cos:                              Special Functions.   (line  29)
483-* mpfr_cosh:                             Special Functions.   (line  95)
484-* mpfr_cot:                              Special Functions.   (line  47)
485-* mpfr_coth:                             Special Functions.   (line 111)
486-* mpfr_csc:                              Special Functions.   (line  46)
487-* mpfr_csch:                             Special Functions.   (line 110)
488+* mpfr_cos:                              Special Functions.   (line  31)
489+* mpfr_cosh:                             Special Functions.   (line  97)
490+* mpfr_cot:                              Special Functions.   (line  49)
491+* mpfr_coth:                             Special Functions.   (line 113)
492+* mpfr_csc:                              Special Functions.   (line  48)
493+* mpfr_csch:                             Special Functions.   (line 112)
494 * mpfr_custom_get_exp:                   Custom Interface.    (line  75)
495 * mpfr_custom_get_kind:                  Custom Interface.    (line  65)
496 * mpfr_custom_get_significand:           Custom Interface.    (line  70)
497@@ -3756,47 +3774,47 @@
498 * mpfr_custom_move:                      Custom Interface.    (line  82)
499 * MPFR_DECL_INIT:                        Initialization Functions.
500                                                               (line  74)
501-* mpfr_digamma:                          Special Functions.   (line 166)
502+* mpfr_digamma:                          Special Functions.   (line 172)
503 * mpfr_dim:                              Basic Arithmetic Functions.
504-                                                              (line 166)
505+                                                              (line 171)
506 * mpfr_div:                              Basic Arithmetic Functions.
507-                                                              (line  72)
508+                                                              (line  74)
509 * mpfr_divby0_p:                         Exception Related Functions.
510                                                               (line 134)
511 * mpfr_div_2exp:                         Compatibility with MPF.
512                                                               (line  49)
513 * mpfr_div_2si:                          Basic Arithmetic Functions.
514-                                                              (line 181)
515+                                                              (line 186)
516 * mpfr_div_2ui:                          Basic Arithmetic Functions.
517-                                                              (line 179)
518+                                                              (line 184)
519 * mpfr_div_d:                            Basic Arithmetic Functions.
520-                                                              (line  84)
521+                                                              (line  86)
522 * mpfr_div_q:                            Basic Arithmetic Functions.
523-                                                              (line  88)
524+                                                              (line  90)
525 * mpfr_div_si:                           Basic Arithmetic Functions.
526-                                                              (line  80)
527+                                                              (line  82)
528 * mpfr_div_ui:                           Basic Arithmetic Functions.
529-                                                              (line  76)
530+                                                              (line  78)
531 * mpfr_div_z:                            Basic Arithmetic Functions.
532-                                                              (line  86)
533+                                                              (line  88)
534 * mpfr_d_div:                            Basic Arithmetic Functions.
535-                                                              (line  82)
536+                                                              (line  84)
537 * mpfr_d_sub:                            Basic Arithmetic Functions.
538-                                                              (line  35)
539-* mpfr_eint:                             Special Functions.   (line 133)
540+                                                              (line  36)
541+* mpfr_eint:                             Special Functions.   (line 135)
542 * mpfr_eq:                               Compatibility with MPF.
543                                                               (line  28)
544 * mpfr_equal_p:                          Comparison Functions.
545                                                               (line  59)
546 * mpfr_erangeflag_p:                     Exception Related Functions.
547                                                               (line 137)
548-* mpfr_erf:                              Special Functions.   (line 177)
549-* mpfr_erfc:                             Special Functions.   (line 178)
550-* mpfr_exp:                              Special Functions.   (line  23)
551-* mpfr_exp10:                            Special Functions.   (line  25)
552-* mpfr_exp2:                             Special Functions.   (line  24)
553-* mpfr_expm1:                            Special Functions.   (line 129)
554-* mpfr_fac_ui:                           Special Functions.   (line 121)
555+* mpfr_erf:                              Special Functions.   (line 183)
556+* mpfr_erfc:                             Special Functions.   (line 184)
557+* mpfr_exp:                              Special Functions.   (line  25)
558+* mpfr_exp10:                            Special Functions.   (line  27)
559+* mpfr_exp2:                             Special Functions.   (line  26)
560+* mpfr_expm1:                            Special Functions.   (line 131)
561+* mpfr_fac_ui:                           Special Functions.   (line 123)
562 * mpfr_fits_intmax_p:                    Conversion Functions.
563                                                               (line 150)
564 * mpfr_fits_sint_p:                      Conversion Functions.
565@@ -3815,20 +3833,20 @@
566                                                               (line 147)
567 * mpfr_floor:                            Integer Related Functions.
568                                                               (line   8)
569-* mpfr_fma:                              Special Functions.   (line 203)
570+* mpfr_fma:                              Special Functions.   (line 209)
571 * mpfr_fmod:                             Integer Related Functions.
572                                                               (line  92)
573-* mpfr_fms:                              Special Functions.   (line 205)
574+* mpfr_fms:                              Special Functions.   (line 211)
575 * mpfr_fprintf:                          Formatted Output Functions.
576                                                               (line 157)
577 * mpfr_frac:                             Integer Related Functions.
578                                                               (line  76)
579-* mpfr_free_cache:                       Special Functions.   (line 244)
580+* mpfr_free_cache:                       Special Functions.   (line 254)
581 * mpfr_free_str:                         Conversion Functions.
582                                                               (line 137)
583 * mpfr_frexp:                            Conversion Functions.
584                                                               (line  45)
585-* mpfr_gamma:                            Special Functions.   (line 148)
586+* mpfr_gamma:                            Special Functions.   (line 150)
587 * mpfr_get_d:                            Conversion Functions.
588                                                               (line   7)
589 * mpfr_get_decimal64:                    Conversion Functions.
590@@ -3887,7 +3905,7 @@
591                                                               (line  56)
592 * mpfr_greater_p:                        Comparison Functions.
593                                                               (line  55)
594-* mpfr_hypot:                            Special Functions.   (line 218)
595+* mpfr_hypot:                            Special Functions.   (line 227)
596 * mpfr_inexflag_p:                       Exception Related Functions.
597                                                               (line 136)
598 * mpfr_inf_p:                            Comparison Functions.
599@@ -3922,21 +3940,21 @@
600                                                               (line  31)
601 * mpfr_integer_p:                        Integer Related Functions.
602                                                               (line 119)
603-* mpfr_j0:                               Special Functions.   (line 182)
604-* mpfr_j1:                               Special Functions.   (line 183)
605-* mpfr_jn:                               Special Functions.   (line 184)
606+* mpfr_j0:                               Special Functions.   (line 188)
607+* mpfr_j1:                               Special Functions.   (line 189)
608+* mpfr_jn:                               Special Functions.   (line 190)
609 * mpfr_lessequal_p:                      Comparison Functions.
610                                                               (line  58)
611 * mpfr_lessgreater_p:                    Comparison Functions.
612                                                               (line  64)
613 * mpfr_less_p:                           Comparison Functions.
614                                                               (line  57)
615-* mpfr_lgamma:                           Special Functions.   (line 157)
616-* mpfr_li2:                              Special Functions.   (line 143)
617-* mpfr_lngamma:                          Special Functions.   (line 152)
618+* mpfr_lgamma:                           Special Functions.   (line 162)
619+* mpfr_li2:                              Special Functions.   (line 145)
620+* mpfr_lngamma:                          Special Functions.   (line 154)
621 * mpfr_log:                              Special Functions.   (line  16)
622 * mpfr_log10:                            Special Functions.   (line  18)
623-* mpfr_log1p:                            Special Functions.   (line 125)
624+* mpfr_log1p:                            Special Functions.   (line 127)
625 * mpfr_log2:                             Special Functions.   (line  17)
626 * mpfr_max:                              Miscellaneous Functions.
627                                                               (line  22)
628@@ -3947,29 +3965,29 @@
629 * mpfr_modf:                             Integer Related Functions.
630                                                               (line  82)
631 * mpfr_mul:                              Basic Arithmetic Functions.
632-                                                              (line  51)
633+                                                              (line  53)
634 * mpfr_mul_2exp:                         Compatibility with MPF.
635                                                               (line  47)
636 * mpfr_mul_2si:                          Basic Arithmetic Functions.
637-                                                              (line 174)
638+                                                              (line 179)
639 * mpfr_mul_2ui:                          Basic Arithmetic Functions.
640-                                                              (line 172)
641+                                                              (line 177)
642 * mpfr_mul_d:                            Basic Arithmetic Functions.
643-                                                              (line  57)
644+                                                              (line  59)
645 * mpfr_mul_q:                            Basic Arithmetic Functions.
646-                                                              (line  61)
647+                                                              (line  63)
648 * mpfr_mul_si:                           Basic Arithmetic Functions.
649-                                                              (line  55)
650+                                                              (line  57)
651 * mpfr_mul_ui:                           Basic Arithmetic Functions.
652-                                                              (line  53)
653+                                                              (line  55)
654 * mpfr_mul_z:                            Basic Arithmetic Functions.
655-                                                              (line  59)
656+                                                              (line  61)
657 * mpfr_nanflag_p:                        Exception Related Functions.
658                                                               (line 135)
659 * mpfr_nan_p:                            Comparison Functions.
660                                                               (line  39)
661 * mpfr_neg:                              Basic Arithmetic Functions.
662-                                                              (line 159)
663+                                                              (line 164)
664 * mpfr_nextabove:                        Miscellaneous Functions.
665                                                               (line  15)
666 * mpfr_nextbelow:                        Miscellaneous Functions.
667@@ -3983,13 +4001,13 @@
668 * mpfr_overflow_p:                       Exception Related Functions.
669                                                               (line 133)
670 * mpfr_pow:                              Basic Arithmetic Functions.
671-                                                              (line 116)
672+                                                              (line 121)
673 * mpfr_pow_si:                           Basic Arithmetic Functions.
674-                                                              (line 120)
675+                                                              (line 125)
676 * mpfr_pow_ui:                           Basic Arithmetic Functions.
677-                                                              (line 118)
678+                                                              (line 123)
679 * mpfr_pow_z:                            Basic Arithmetic Functions.
680-                                                              (line 122)
681+                                                              (line 127)
682 * mpfr_prec_round:                       Rounding Related Functions.
683                                                               (line  13)
684 * ‘mpfr_prec_t’:                         Nomenclature and Types.
685@@ -3999,7 +4017,7 @@
686 * mpfr_print_rnd_mode:                   Rounding Related Functions.
687                                                               (line  71)
688 * mpfr_rec_sqrt:                         Basic Arithmetic Functions.
689-                                                              (line 103)
690+                                                              (line 105)
691 * mpfr_regular_p:                        Comparison Functions.
692                                                               (line  43)
693 * mpfr_reldiff:                          Compatibility with MPF.
694@@ -4021,11 +4039,11 @@
695 * ‘mpfr_rnd_t’:                          Nomenclature and Types.
696                                                               (line  34)
697 * mpfr_root:                             Basic Arithmetic Functions.
698-                                                              (line 109)
699+                                                              (line 114)
700 * mpfr_round:                            Integer Related Functions.
701                                                               (line   9)
702-* mpfr_sec:                              Special Functions.   (line  45)
703-* mpfr_sech:                             Special Functions.   (line 109)
704+* mpfr_sec:                              Special Functions.   (line  47)
705+* mpfr_sech:                             Special Functions.   (line 111)
706 * mpfr_set:                              Assignment Functions.
707                                                               (line   9)
708 * mpfr_setsign:                          Miscellaneous Functions.
709@@ -4100,57 +4118,57 @@
710                                                               (line  49)
711 * mpfr_signbit:                          Miscellaneous Functions.
712                                                               (line  99)
713-* mpfr_sin:                              Special Functions.   (line  30)
714-* mpfr_sinh:                             Special Functions.   (line  96)
715-* mpfr_sinh_cosh:                        Special Functions.   (line 101)
716-* mpfr_sin_cos:                          Special Functions.   (line  35)
717+* mpfr_sin:                              Special Functions.   (line  32)
718+* mpfr_sinh:                             Special Functions.   (line  98)
719+* mpfr_sinh_cosh:                        Special Functions.   (line 103)
720+* mpfr_sin_cos:                          Special Functions.   (line  37)
721 * mpfr_si_div:                           Basic Arithmetic Functions.
722-                                                              (line  78)
723+                                                              (line  80)
724 * mpfr_si_sub:                           Basic Arithmetic Functions.
725-                                                              (line  31)
726+                                                              (line  32)
727 * mpfr_snprintf:                         Formatted Output Functions.
728                                                               (line 180)
729 * mpfr_sprintf:                          Formatted Output Functions.
730                                                               (line 170)
731 * mpfr_sqr:                              Basic Arithmetic Functions.
732-                                                              (line  69)
733+                                                              (line  71)
734 * mpfr_sqrt:                             Basic Arithmetic Functions.
735-                                                              (line  96)
736+                                                              (line  98)
737 * mpfr_sqrt_ui:                          Basic Arithmetic Functions.
738-                                                              (line  97)
739+                                                              (line  99)
740 * mpfr_strtofr:                          Assignment Functions.
741                                                               (line  80)
742 * mpfr_sub:                              Basic Arithmetic Functions.
743-                                                              (line  25)
744+                                                              (line  26)
745 * mpfr_subnormalize:                     Exception Related Functions.
746                                                               (line  60)
747 * mpfr_sub_d:                            Basic Arithmetic Functions.
748-                                                              (line  37)
749+                                                              (line  38)
750 * mpfr_sub_q:                            Basic Arithmetic Functions.
751-                                                              (line  43)
752+                                                              (line  44)
753 * mpfr_sub_si:                           Basic Arithmetic Functions.
754-                                                              (line  33)
755+                                                              (line  34)
756 * mpfr_sub_ui:                           Basic Arithmetic Functions.
757-                                                              (line  29)
758+                                                              (line  30)
759 * mpfr_sub_z:                            Basic Arithmetic Functions.
760-                                                              (line  41)
761-* mpfr_sum:                              Special Functions.   (line 252)
762+                                                              (line  42)
763+* mpfr_sum:                              Special Functions.   (line 262)
764 * mpfr_swap:                             Assignment Functions.
765                                                               (line 150)
766 * ‘mpfr_t’:                              Nomenclature and Types.
767                                                               (line   6)
768-* mpfr_tan:                              Special Functions.   (line  31)
769-* mpfr_tanh:                             Special Functions.   (line  97)
770+* mpfr_tan:                              Special Functions.   (line  33)
771+* mpfr_tanh:                             Special Functions.   (line  99)
772 * mpfr_trunc:                            Integer Related Functions.
773                                                               (line  10)
774 * mpfr_ui_div:                           Basic Arithmetic Functions.
775-                                                              (line  74)
776+                                                              (line  76)
777 * mpfr_ui_pow:                           Basic Arithmetic Functions.
778-                                                              (line 126)
779+                                                              (line 131)
780 * mpfr_ui_pow_ui:                        Basic Arithmetic Functions.
781-                                                              (line 124)
782+                                                              (line 129)
783 * mpfr_ui_sub:                           Basic Arithmetic Functions.
784-                                                              (line  27)
785+                                                              (line  28)
786 * mpfr_underflow_p:                      Exception Related Functions.
787                                                               (line 132)
788 * mpfr_unordered_p:                      Comparison Functions.
789@@ -4181,61 +4199,61 @@
790                                                               (line 182)
791 * mpfr_vsprintf:                         Formatted Output Functions.
792                                                               (line 171)
793-* mpfr_y0:                               Special Functions.   (line 193)
794-* mpfr_y1:                               Special Functions.   (line 194)
795-* mpfr_yn:                               Special Functions.   (line 195)
796+* mpfr_y0:                               Special Functions.   (line 199)
797+* mpfr_y1:                               Special Functions.   (line 200)
798+* mpfr_yn:                               Special Functions.   (line 201)
799 * mpfr_zero_p:                           Comparison Functions.
800                                                               (line  42)
801-* mpfr_zeta:                             Special Functions.   (line 171)
802-* mpfr_zeta_ui:                          Special Functions.   (line 172)
803+* mpfr_zeta:                             Special Functions.   (line 177)
804+* mpfr_zeta_ui:                          Special Functions.   (line 178)
805 * mpfr_z_sub:                            Basic Arithmetic Functions.
806-                                                              (line  39)
807+                                                              (line  40)
808 
809 
810 
811 Tag Table:
812 Node: Top775
813 Node: Copying2007
814-Node: Introduction to MPFR3766
815-Node: Installing MPFR5880
816-Node: Reporting Bugs11323
817-Node: MPFR Basics13353
818-Node: Headers and Libraries13669
819-Node: Nomenclature and Types16828
820-Node: MPFR Variable Conventions18874
821-Node: Rounding Modes20418
822-Ref: ternary value21544
823-Node: Floating-Point Values on Special Numbers23526
824-Node: Exceptions26572
825-Node: Memory Handling29749
826-Node: MPFR Interface30894
827-Node: Initialization Functions33008
828-Node: Assignment Functions40318
829-Node: Combined Initialization and Assignment Functions49673
830-Node: Conversion Functions50974
831-Node: Basic Arithmetic Functions60035
832-Node: Comparison Functions69200
833-Node: Special Functions72687
834-Node: Input and Output Functions86672
835-Node: Formatted Output Functions88644
836-Node: Integer Related Functions98431
837-Node: Rounding Related Functions105051
838-Node: Miscellaneous Functions108888
839-Node: Exception Related Functions117568
840-Node: Compatibility with MPF124386
841-Node: Custom Interface127127
842-Node: Internals131526
843-Node: API Compatibility133066
844-Node: Type and Macro Changes134995
845-Node: Added Functions137844
846-Node: Changed Functions141132
847-Node: Removed Functions145545
848-Node: Other Changes145973
849-Node: Contributors147576
850-Node: References150219
851-Node: GNU Free Documentation License151973
852-Node: Concept Index174562
853-Node: Function and Type Index180659
854+Node: Introduction to MPFR3770
855+Node: Installing MPFR5884
856+Node: Reporting Bugs11327
857+Node: MPFR Basics13357
858+Node: Headers and Libraries13673
859+Node: Nomenclature and Types16832
860+Node: MPFR Variable Conventions18894
861+Node: Rounding Modes20438
862+Ref: ternary value21568
863+Node: Floating-Point Values on Special Numbers23554
864+Node: Exceptions26813
865+Node: Memory Handling29990
866+Node: MPFR Interface31135
867+Node: Initialization Functions33249
868+Node: Assignment Functions40559
869+Node: Combined Initialization and Assignment Functions49914
870+Node: Conversion Functions51215
871+Node: Basic Arithmetic Functions60276
872+Node: Comparison Functions69777
873+Node: Special Functions73264
874+Node: Input and Output Functions87862
875+Node: Formatted Output Functions89834
876+Node: Integer Related Functions99621
877+Node: Rounding Related Functions106241
878+Node: Miscellaneous Functions110078
879+Node: Exception Related Functions118758
880+Node: Compatibility with MPF125576
881+Node: Custom Interface128317
882+Node: Internals132716
883+Node: API Compatibility134260
884+Node: Type and Macro Changes136189
885+Node: Added Functions139038
886+Node: Changed Functions142326
887+Node: Removed Functions146739
888+Node: Other Changes147167
889+Node: Contributors148770
890+Node: References151413
891+Node: GNU Free Documentation License153167
892+Node: Concept Index175760
893+Node: Function and Type Index181857
894 
895 End Tag Table
896 
897diff -Naurd mpfr-3.1.3-a/src/lngamma.c mpfr-3.1.3-b/src/lngamma.c
898--- mpfr-3.1.3-a/src/lngamma.c  2015-06-19 19:55:10.000000000 +0000
899+++ mpfr-3.1.3-b/src/lngamma.c  2015-07-02 10:49:24.018113593 +0000
900@@ -603,16 +603,17 @@
901       mpfr_get_prec (y), mpfr_log_prec, y, inex));
902 
903   /* special cases */
904-  if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
905+  if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x) ||
906+                     (MPFR_IS_NEG (x) && mpfr_integer_p (x))))
907     {
908-      if (MPFR_IS_NAN (x) || MPFR_IS_NEG (x))
909+      if (MPFR_IS_NAN (x))
910         {
911           MPFR_SET_NAN (y);
912           MPFR_RET_NAN;
913         }
914-      else /* lngamma(+Inf) = lngamma(+0) = +Inf */
915+      else /* lngamma(+/-Inf) = lngamma(nonpositive integer) = +Inf */
916         {
917-          if (MPFR_IS_ZERO (x))
918+          if (!MPFR_IS_INF (x))
919             mpfr_set_divby0 ();
920           MPFR_SET_INF (y);
921           MPFR_SET_POS (y);
922@@ -620,8 +621,8 @@
923         }
924     }
925 
926-  /* if x < 0 and -2k-1 <= x <= -2k, then lngamma(x) = NaN */
927-  if (MPFR_IS_NEG (x) && (unit_bit (x) == 0 || mpfr_integer_p (x)))
928+  /* if -2k-1 < x < -2k <= 0, then lngamma(x) = NaN */
929+  if (MPFR_IS_NEG (x) && unit_bit (x) == 0)
930     {
931       MPFR_SET_NAN (y);
932       MPFR_RET_NAN;
933diff -Naurd mpfr-3.1.3-a/src/mpfr.h mpfr-3.1.3-b/src/mpfr.h
934--- mpfr-3.1.3-a/src/mpfr.h     2015-06-19 19:55:10.000000000 +0000
935+++ mpfr-3.1.3-b/src/mpfr.h     2015-07-02 10:49:24.038113803 +0000
936@@ -27,7 +27,7 @@
937 #define MPFR_VERSION_MAJOR 3
938 #define MPFR_VERSION_MINOR 1
939 #define MPFR_VERSION_PATCHLEVEL 3
940-#define MPFR_VERSION_STRING "3.1.3"
941+#define MPFR_VERSION_STRING "3.1.3-p1"
942 
943 /* Macros dealing with MPFR VERSION */
944 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
945diff -Naurd mpfr-3.1.3-a/src/version.c mpfr-3.1.3-b/src/version.c
946--- mpfr-3.1.3-a/src/version.c  2015-06-19 19:55:10.000000000 +0000
947+++ mpfr-3.1.3-b/src/version.c  2015-07-02 10:49:24.042113845 +0000
948@@ -25,5 +25,5 @@
949 const char *
950 mpfr_get_version (void)
951 {
952-  return "3.1.3";
953+  return "3.1.3-p1";
954 }
955diff -Naurd mpfr-3.1.3-a/tests/tlngamma.c mpfr-3.1.3-b/tests/tlngamma.c
956--- mpfr-3.1.3-a/tests/tlngamma.c       2015-06-19 19:55:10.000000000 +0000
957+++ mpfr-3.1.3-b/tests/tlngamma.c       2015-07-02 10:49:24.018113593 +0000
958@@ -33,7 +33,7 @@
959 special (void)
960 {
961   mpfr_t x, y;
962-  int inex;
963+  int i, inex;
964 
965   mpfr_init (x);
966   mpfr_init (y);
967@@ -46,25 +46,29 @@
968       exit (1);
969     }
970 
971-  mpfr_set_inf (x, -1);
972+  mpfr_set_inf (x, 1);
973+  mpfr_clear_flags ();
974   mpfr_lngamma (y, x, MPFR_RNDN);
975-  if (!mpfr_nan_p (y))
976+  if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 || __gmpfr_flags != 0)
977     {
978-      printf ("Error for lngamma(-Inf)\n");
979+      printf ("Error for lngamma(+Inf)\n");
980       exit (1);
981     }
982 
983-  mpfr_set_inf (x, 1);
984+  mpfr_set_inf (x, -1);
985+  mpfr_clear_flags ();
986   mpfr_lngamma (y, x, MPFR_RNDN);
987-  if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
988+  if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 || __gmpfr_flags != 0)
989     {
990-      printf ("Error for lngamma(+Inf)\n");
991+      printf ("Error for lngamma(-Inf)\n");
992       exit (1);
993     }
994 
995   mpfr_set_ui (x, 0, MPFR_RNDN);
996+  mpfr_clear_flags ();
997   mpfr_lngamma (y, x, MPFR_RNDN);
998-  if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
999+  if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 ||
1000+      __gmpfr_flags != MPFR_FLAGS_DIVBY0)
1001     {
1002       printf ("Error for lngamma(+0)\n");
1003       exit (1);
1004@@ -72,32 +76,58 @@
1005 
1006   mpfr_set_ui (x, 0, MPFR_RNDN);
1007   mpfr_neg (x, x, MPFR_RNDN);
1008+  mpfr_clear_flags ();
1009   mpfr_lngamma (y, x, MPFR_RNDN);
1010-  if (!mpfr_nan_p (y))
1011+  if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 ||
1012+      __gmpfr_flags != MPFR_FLAGS_DIVBY0)
1013     {
1014       printf ("Error for lngamma(-0)\n");
1015       exit (1);
1016     }
1017 
1018   mpfr_set_ui (x, 1, MPFR_RNDN);
1019+  mpfr_clear_flags ();
1020   mpfr_lngamma (y, x, MPFR_RNDN);
1021-  if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y))
1022+  if (mpfr_cmp_ui0 (y, 0) || MPFR_IS_NEG (y))
1023     {
1024       printf ("Error for lngamma(1)\n");
1025       exit (1);
1026     }
1027 
1028-  mpfr_set_si (x, -1, MPFR_RNDN);
1029-  mpfr_lngamma (y, x, MPFR_RNDN);
1030-  if (!mpfr_nan_p (y))
1031+  for (i = 1; i <= 5; i++)
1032     {
1033-      printf ("Error for lngamma(-1)\n");
1034-      exit (1);
1035+      int c;
1036+
1037+      mpfr_set_si (x, -i, MPFR_RNDN);
1038+      mpfr_clear_flags ();
1039+      mpfr_lngamma (y, x, MPFR_RNDN);
1040+      if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 ||
1041+          __gmpfr_flags != MPFR_FLAGS_DIVBY0)
1042+        {
1043+          printf ("Error for lngamma(-%d)\n", i);
1044+          exit (1);
1045+        }
1046+      if (i & 1)
1047+        {
1048+          mpfr_nextabove (x);
1049+          c = '+';
1050+        }
1051+      else
1052+        {
1053+          mpfr_nextbelow (x);
1054+          c = '-';
1055+        }
1056+      mpfr_lngamma (y, x, MPFR_RNDN);
1057+      if (!mpfr_nan_p (y))
1058+        {
1059+          printf ("Error for lngamma(-%d%cepsilon)\n", i, c);
1060+          exit (1);
1061+        }
1062     }
1063 
1064   mpfr_set_ui (x, 2, MPFR_RNDN);
1065   mpfr_lngamma (y, x, MPFR_RNDN);
1066-  if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y))
1067+  if (mpfr_cmp_ui0 (y, 0) || MPFR_IS_NEG (y))
1068     {
1069       printf ("Error for lngamma(2)\n");
1070       exit (1);
1071@@ -127,7 +157,7 @@
1072   mpfr_set_str (x, CHECK_X2, 10, MPFR_RNDN);
1073   mpfr_lngamma (y, x, MPFR_RNDN);
1074   mpfr_set_str (x, CHECK_Y2, 10, MPFR_RNDN);
1075-  if (MPFR_IS_NAN (y) || mpfr_cmp (y, x))
1076+  if (mpfr_cmp0 (y, x))
1077     {
1078       printf ("mpfr_lngamma("CHECK_X2") is wrong:\n"
1079               "expected ");
1080@@ -143,7 +173,7 @@
1081   mpfr_lngamma (y, x, MPFR_RNDU);
1082   mpfr_set_prec (x, 175);
1083   mpfr_set_str_binary (x, "0.1010001100011101101011001101110010100001000001000001110011000001101100001111001001000101011011100100010101011110100111110101010100010011010010000101010111001100011000101111E7");
1084-  if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
1085+  if (mpfr_cmp0 (x, y))
1086     {
1087       printf ("Error in mpfr_lngamma (1)\n");
1088       exit (1);
1089@@ -155,7 +185,7 @@
1090   mpfr_lngamma (x, y, MPFR_RNDZ);
1091   mpfr_set_prec (y, 21);
1092   mpfr_set_str_binary (y, "0.111000101000001100101E9");
1093-  if (MPFR_IS_NAN (x) || mpfr_cmp (x, y))
1094+  if (mpfr_cmp0 (x, y))
1095     {
1096       printf ("Error in mpfr_lngamma (120)\n");
1097       printf ("Expected "); mpfr_print_binary (y); puts ("");
1098@@ -169,7 +199,7 @@
1099   inex = mpfr_lngamma (y, x, MPFR_RNDN);
1100   mpfr_set_prec (x, 206);
1101   mpfr_set_str_binary (x, "0.10000111011000000011100010101001100110001110000111100011000100100110110010001011011110101001111011110110000001010100111011010000000011100110110101100111000111010011110010000100010111101010001101000110101001E13");
1102-  if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
1103+  if (mpfr_cmp0 (x, y))
1104     {
1105       printf ("Error in mpfr_lngamma (768)\n");
1106       exit (1);
1107@@ -185,7 +215,7 @@
1108   mpfr_set_str_binary (x, "0.1100E-66");
1109   mpfr_lngamma (y, x, MPFR_RNDN);
1110   mpfr_set_str_binary (x, "0.1100E6");
1111-  if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
1112+  if (mpfr_cmp0 (x, y))
1113     {
1114       printf ("Error for lngamma(0.1100E-66)\n");
1115       exit (1);
1116@@ -199,7 +229,7 @@
1117   mpfr_lngamma (y, x, MPFR_RNDN);
1118   mpfr_set_prec (x, 32);
1119   mpfr_set_str_binary (x, "-0.10001000111011111011000010100010E207");
1120-  if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
1121+  if (mpfr_cmp0 (x, y))
1122     {
1123       printf ("Error for lngamma(-2^199+0.5)\n");
1124       printf ("Got        ");
1125diff -Naurd mpfr-3.1.3-a/PATCHES mpfr-3.1.3-b/PATCHES
1126--- mpfr-3.1.3-a/PATCHES        2015-07-02 10:50:08.046573308 +0000
1127+++ mpfr-3.1.3-b/PATCHES        2015-07-02 10:50:08.126574142 +0000
1128@@ -0,0 +1 @@
1129+muldiv-2exp-overflow
1130diff -Naurd mpfr-3.1.3-a/VERSION mpfr-3.1.3-b/VERSION
1131--- mpfr-3.1.3-a/VERSION        2015-07-02 10:49:24.042113845 +0000
1132+++ mpfr-3.1.3-b/VERSION        2015-07-02 10:50:08.126574142 +0000
1133@@ -1 +1 @@
1134-3.1.3-p1
1135+3.1.3-p2
1136diff -Naurd mpfr-3.1.3-a/src/div_2si.c mpfr-3.1.3-b/src/div_2si.c
1137--- mpfr-3.1.3-a/src/div_2si.c  2015-06-19 19:55:10.000000000 +0000
1138+++ mpfr-3.1.3-b/src/div_2si.c  2015-07-02 10:50:08.106573933 +0000
1139@@ -49,7 +49,7 @@
1140             rnd_mode = MPFR_RNDZ;
1141           return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y));
1142         }
1143-      else if (MPFR_UNLIKELY(n < 0 && (__gmpfr_emax < MPFR_EMIN_MIN - n ||
1144+      else if (MPFR_UNLIKELY(n <= 0 && (__gmpfr_emax < MPFR_EMIN_MIN - n ||
1145                                        exp > __gmpfr_emax + n)) )
1146         return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y));
1147 
1148diff -Naurd mpfr-3.1.3-a/src/div_2ui.c mpfr-3.1.3-b/src/div_2ui.c
1149--- mpfr-3.1.3-a/src/div_2ui.c  2015-06-19 19:55:10.000000000 +0000
1150+++ mpfr-3.1.3-b/src/div_2ui.c  2015-07-02 10:50:08.106573933 +0000
1151@@ -32,7 +32,7 @@
1152      rnd_mode),
1153     ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inexact));
1154 
1155-  if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
1156+  if (MPFR_UNLIKELY (n == 0 || MPFR_IS_SINGULAR (x)))
1157     return mpfr_set (y, x, rnd_mode);
1158   else
1159     {
1160diff -Naurd mpfr-3.1.3-a/src/mpfr.h mpfr-3.1.3-b/src/mpfr.h
1161--- mpfr-3.1.3-a/src/mpfr.h     2015-07-02 10:49:24.038113803 +0000
1162+++ mpfr-3.1.3-b/src/mpfr.h     2015-07-02 10:50:08.126574142 +0000
1163@@ -27,7 +27,7 @@
1164 #define MPFR_VERSION_MAJOR 3
1165 #define MPFR_VERSION_MINOR 1
1166 #define MPFR_VERSION_PATCHLEVEL 3
1167-#define MPFR_VERSION_STRING "3.1.3-p1"
1168+#define MPFR_VERSION_STRING "3.1.3-p2"
1169 
1170 /* Macros dealing with MPFR VERSION */
1171 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
1172diff -Naurd mpfr-3.1.3-a/src/mul_2si.c mpfr-3.1.3-b/src/mul_2si.c
1173--- mpfr-3.1.3-a/src/mul_2si.c  2015-06-19 19:55:10.000000000 +0000
1174+++ mpfr-3.1.3-b/src/mul_2si.c  2015-07-02 10:50:08.106573933 +0000
1175@@ -39,7 +39,7 @@
1176     {
1177       mpfr_exp_t exp = MPFR_GET_EXP (x);
1178       MPFR_SETRAW (inexact, y, x, exp, rnd_mode);
1179-      if (MPFR_UNLIKELY( n > 0 && (__gmpfr_emax < MPFR_EMIN_MIN + n ||
1180+      if (MPFR_UNLIKELY(n >= 0 && (__gmpfr_emax < MPFR_EMIN_MIN + n ||
1181                                    exp > __gmpfr_emax - n)))
1182         return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y));
1183       else if (MPFR_UNLIKELY(n < 0 && (__gmpfr_emin > MPFR_EMAX_MAX + n ||
1184diff -Naurd mpfr-3.1.3-a/src/version.c mpfr-3.1.3-b/src/version.c
1185--- mpfr-3.1.3-a/src/version.c  2015-07-02 10:49:24.042113845 +0000
1186+++ mpfr-3.1.3-b/src/version.c  2015-07-02 10:50:08.126574142 +0000
1187@@ -25,5 +25,5 @@
1188 const char *
1189 mpfr_get_version (void)
1190 {
1191-  return "3.1.3-p1";
1192+  return "3.1.3-p2";
1193 }
1194diff -Naurd mpfr-3.1.3-a/tests/tmul_2exp.c mpfr-3.1.3-b/tests/tmul_2exp.c
1195--- mpfr-3.1.3-a/tests/tmul_2exp.c      2015-06-19 19:55:10.000000000 +0000
1196+++ mpfr-3.1.3-b/tests/tmul_2exp.c      2015-07-02 10:50:08.106573933 +0000
1197@@ -242,6 +242,76 @@
1198   large (MPFR_EMAX_MAX);
1199 }
1200 
1201+/* Cases where the function overflows on n = 0 when rounding is like
1202+   away from zero. */
1203+static void
1204+overflow0 (mpfr_exp_t emax)
1205+{
1206+  mpfr_exp_t old_emax;
1207+  mpfr_t x, y1, y2;
1208+  int neg, r, op;
1209+  static char *sop[4] = { "mul_2ui", "mul_2si", "div_2ui", "div_2si" };
1210+
1211+  old_emax = mpfr_get_emax ();
1212+  set_emax (emax);
1213+
1214+  mpfr_init2 (x, 8);
1215+  mpfr_inits2 (6, y1, y2, (mpfr_ptr) 0);
1216+
1217+  mpfr_set_inf (x, 1);
1218+  mpfr_nextbelow (x);
1219+
1220+  for (neg = 0; neg <= 1; neg++)
1221+    {
1222+      RND_LOOP (r)
1223+        {
1224+          int inex1, inex2;
1225+          unsigned int flags1, flags2;
1226+
1227+          /* Even if there isn't an overflow (rounding ~ toward zero),
1228+             the result is the same as the one of an overflow. */
1229+          inex1 = mpfr_overflow (y1, (mpfr_rnd_t) r, neg ? -1 : 1);
1230+          flags1 = MPFR_FLAGS_INEXACT;
1231+          if (mpfr_inf_p (y1))
1232+            flags1 |= MPFR_FLAGS_OVERFLOW;
1233+          for (op = 0; op < 4; op++)
1234+            {
1235+              mpfr_clear_flags ();
1236+              inex2 =
1237+                op == 0 ? mpfr_mul_2ui (y2, x, 0, (mpfr_rnd_t) r) :
1238+                op == 1 ? mpfr_mul_2si (y2, x, 0, (mpfr_rnd_t) r) :
1239+                op == 2 ? mpfr_div_2ui (y2, x, 0, (mpfr_rnd_t) r) :
1240+                op == 3 ? mpfr_div_2si (y2, x, 0, (mpfr_rnd_t) r) :
1241+                (MPFR_ASSERTN (0), 0);
1242+              flags2 = __gmpfr_flags;
1243+              if (!(mpfr_equal_p (y1, y2) &&
1244+                    SAME_SIGN (inex1, inex2) &&
1245+                    flags1 == flags2))
1246+                {
1247+                  printf ("Error in overflow0 for %s, mpfr_%s, emax = %"
1248+                          MPFR_EXP_FSPEC "d,\nx = ",
1249+                          mpfr_print_rnd_mode ((mpfr_rnd_t) r), sop[op],
1250+                          (mpfr_eexp_t) emax);
1251+                  mpfr_dump (x);
1252+                  printf ("Expected ");
1253+                  mpfr_dump (y1);
1254+                  printf ("  with inex = %d, flags =", inex1);
1255+                  flags_out (flags1);
1256+                  printf ("Got      ");
1257+                  mpfr_dump (y2);
1258+                  printf ("  with inex = %d, flags =", inex2);
1259+                  flags_out (flags2);
1260+                  exit (1);
1261+                }
1262+            }
1263+        }
1264+      mpfr_neg (x, x, MPFR_RNDN);
1265+    }
1266+
1267+  mpfr_clears (x, y1, y2, (mpfr_ptr) 0);
1268+  set_emax (old_emax);
1269+}
1270+
1271 int
1272 main (int argc, char *argv[])
1273 {
1274@@ -334,6 +404,11 @@
1275   underflow0 ();
1276   large0 ();
1277 
1278+  if (mpfr_get_emax () != MPFR_EMAX_MAX)
1279+    overflow0 (mpfr_get_emax ());
1280+  overflow0 (MPFR_EMAX_MAX);
1281+  overflow0 (-1);
1282+
1283   tests_end_mpfr ();
1284   return 0;
1285 }
1286diff -Naurd mpfr-3.1.3-a/PATCHES mpfr-3.1.3-b/PATCHES
1287--- mpfr-3.1.3-a/PATCHES        2015-07-17 08:54:48.592799981 +0000
1288+++ mpfr-3.1.3-b/PATCHES        2015-07-17 08:54:48.616811495 +0000
1289@@ -0,0 +1 @@
1290+muldiv-2exp-underflow
1291diff -Naurd mpfr-3.1.3-a/VERSION mpfr-3.1.3-b/VERSION
1292--- mpfr-3.1.3-a/VERSION        2015-07-02 10:50:08.126574142 +0000
1293+++ mpfr-3.1.3-b/VERSION        2015-07-17 08:54:48.616811495 +0000
1294@@ -1 +1 @@
1295-3.1.3-p2
1296+3.1.3-p3
1297diff -Naurd mpfr-3.1.3-a/src/div_2si.c mpfr-3.1.3-b/src/div_2si.c
1298--- mpfr-3.1.3-a/src/div_2si.c  2015-07-02 10:50:08.106573933 +0000
1299+++ mpfr-3.1.3-b/src/div_2si.c  2015-07-17 08:54:48.608807656 +0000
1300@@ -45,7 +45,8 @@
1301           if (rnd_mode == MPFR_RNDN &&
1302               (__gmpfr_emin > MPFR_EMAX_MAX - (n - 1) ||
1303                exp < __gmpfr_emin + (n - 1) ||
1304-               (inexact >= 0 && mpfr_powerof2_raw (y))))
1305+               ((MPFR_IS_NEG (y) ? inexact <= 0 : inexact >= 0) &&
1306+                mpfr_powerof2_raw (y))))
1307             rnd_mode = MPFR_RNDZ;
1308           return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y));
1309         }
1310diff -Naurd mpfr-3.1.3-a/src/div_2ui.c mpfr-3.1.3-b/src/div_2ui.c
1311--- mpfr-3.1.3-a/src/div_2ui.c  2015-07-02 10:50:08.106573933 +0000
1312+++ mpfr-3.1.3-b/src/div_2ui.c  2015-07-17 08:54:48.608807656 +0000
1313@@ -44,7 +44,9 @@
1314       if (MPFR_UNLIKELY (n >= diffexp))  /* exp - n <= emin - 1 */
1315         {
1316           if (rnd_mode == MPFR_RNDN &&
1317-              (n > diffexp || (inexact >= 0 && mpfr_powerof2_raw (y))))
1318+              (n > diffexp ||
1319+               ((MPFR_IS_NEG (y) ? inexact <= 0 : inexact >= 0) &&
1320+                mpfr_powerof2_raw (y))))
1321             rnd_mode = MPFR_RNDZ;
1322           return mpfr_underflow (y, rnd_mode, MPFR_SIGN (y));
1323         }
1324diff -Naurd mpfr-3.1.3-a/src/mpfr.h mpfr-3.1.3-b/src/mpfr.h
1325--- mpfr-3.1.3-a/src/mpfr.h     2015-07-02 10:50:08.126574142 +0000
1326+++ mpfr-3.1.3-b/src/mpfr.h     2015-07-17 08:54:48.616811495 +0000
1327@@ -27,7 +27,7 @@
1328 #define MPFR_VERSION_MAJOR 3
1329 #define MPFR_VERSION_MINOR 1
1330 #define MPFR_VERSION_PATCHLEVEL 3
1331-#define MPFR_VERSION_STRING "3.1.3-p2"
1332+#define MPFR_VERSION_STRING "3.1.3-p3"
1333 
1334 /* Macros dealing with MPFR VERSION */
1335 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
1336diff -Naurd mpfr-3.1.3-a/src/mul_2si.c mpfr-3.1.3-b/src/mul_2si.c
1337--- mpfr-3.1.3-a/src/mul_2si.c  2015-07-02 10:50:08.106573933 +0000
1338+++ mpfr-3.1.3-b/src/mul_2si.c  2015-07-17 08:54:48.608807656 +0000
1339@@ -48,7 +48,8 @@
1340           if (rnd_mode == MPFR_RNDN &&
1341               (__gmpfr_emin > MPFR_EMAX_MAX + (n + 1) ||
1342                exp < __gmpfr_emin - (n + 1) ||
1343-               (inexact >= 0 && mpfr_powerof2_raw (y))))
1344+               ((MPFR_IS_NEG (y) ? inexact <= 0 : inexact >= 0) &&
1345+                mpfr_powerof2_raw (y))))
1346             rnd_mode = MPFR_RNDZ;
1347           return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y));
1348         }
1349diff -Naurd mpfr-3.1.3-a/src/version.c mpfr-3.1.3-b/src/version.c
1350--- mpfr-3.1.3-a/src/version.c  2015-07-02 10:50:08.126574142 +0000
1351+++ mpfr-3.1.3-b/src/version.c  2015-07-17 08:54:48.616811495 +0000
1352@@ -25,5 +25,5 @@
1353 const char *
1354 mpfr_get_version (void)
1355 {
1356-  return "3.1.3-p2";
1357+  return "3.1.3-p3";
1358 }
1359diff -Naurd mpfr-3.1.3-a/tests/tmul_2exp.c mpfr-3.1.3-b/tests/tmul_2exp.c
1360--- mpfr-3.1.3-a/tests/tmul_2exp.c      2015-07-02 10:50:08.106573933 +0000
1361+++ mpfr-3.1.3-b/tests/tmul_2exp.c      2015-07-17 08:54:48.608807656 +0000
1362@@ -50,77 +50,82 @@
1363 {
1364   mpfr_t x, y, z1, z2;
1365   mpfr_exp_t emin;
1366-  int i, k;
1367+  int i, k, s;
1368   int prec;
1369   int rnd;
1370   int div;
1371   int inex1, inex2;
1372   unsigned int flags1, flags2;
1373 
1374-  /* Test mul_2si(x, e - k), div_2si(x, k - e) and div_2ui(x, k - e)
1375-   * with emin = e, x = 1 + i/16, i in { -1, 0, 1 }, and k = 1 to 4,
1376-   * by comparing the result with the one of a simple division.
1377+  /* Test mul_2si(x, e - k), div_2si(x, k - e) and div_2ui(x, k - e) with
1378+   * emin = e, x = s * (1 + i/16), i in { -1, 0, 1 }, s in { -1, 1 }, and
1379+   * k = 1 to 4, by comparing the result with the one of a simple division.
1380    */
1381   emin = mpfr_get_emin ();
1382   set_emin (e);
1383   mpfr_inits2 (8, x, y, (mpfr_ptr) 0);
1384   for (i = 15; i <= 17; i++)
1385-    {
1386-      inex1 = mpfr_set_ui_2exp (x, i, -4, MPFR_RNDN);
1387-      MPFR_ASSERTN (inex1 == 0);
1388-      for (prec = 6; prec >= 3; prec -= 3)
1389-        {
1390-          mpfr_inits2 (prec, z1, z2, (mpfr_ptr) 0);
1391-          RND_LOOP (rnd)
1392-            for (k = 1; k <= 4; k++)
1393-              {
1394-                /* The following one is assumed to be correct. */
1395-                inex1 = mpfr_mul_2si (y, x, e, MPFR_RNDN);
1396-                MPFR_ASSERTN (inex1 == 0);
1397-                inex1 = mpfr_set_ui (z1, 1 << k, MPFR_RNDN);
1398-                MPFR_ASSERTN (inex1 == 0);
1399-                mpfr_clear_flags ();
1400-                /* Do not use mpfr_div_ui to avoid the optimization
1401-                   by mpfr_div_2si. */
1402-                inex1 = mpfr_div (z1, y, z1, (mpfr_rnd_t) rnd);
1403-                flags1 = __gmpfr_flags;
1404-
1405-              for (div = 0; div <= 2; div++)
1406+    for (s = 1; s >= -1; s -= 2)
1407+      {
1408+        inex1 = mpfr_set_si_2exp (x, s * i, -4, MPFR_RNDN);
1409+        MPFR_ASSERTN (inex1 == 0);
1410+        for (prec = 6; prec >= 3; prec -= 3)
1411+          {
1412+            mpfr_inits2 (prec, z1, z2, (mpfr_ptr) 0);
1413+            RND_LOOP (rnd)
1414+              for (k = 1; k <= 4; k++)
1415                 {
1416+                  /* The following one is assumed to be correct. */
1417+                  inex1 = mpfr_mul_2si (y, x, e, MPFR_RNDN);
1418+                  MPFR_ASSERTN (inex1 == 0);
1419+                  inex1 = mpfr_set_ui (z1, 1 << k, MPFR_RNDN);
1420+                  MPFR_ASSERTN (inex1 == 0);
1421                   mpfr_clear_flags ();
1422-                  inex2 = div == 0 ?
1423-                    mpfr_mul_2si (z2, x, e - k, (mpfr_rnd_t) rnd) : div == 1 ?
1424-                    mpfr_div_2si (z2, x, k - e, (mpfr_rnd_t) rnd) :
1425-                    mpfr_div_2ui (z2, x, k - e, (mpfr_rnd_t) rnd);
1426-                  flags2 = __gmpfr_flags;
1427-                  if (flags1 == flags2 && SAME_SIGN (inex1, inex2) &&
1428-                      mpfr_equal_p (z1, z2))
1429-                    continue;
1430-                  printf ("Error in underflow(");
1431-                  if (e == MPFR_EMIN_MIN)
1432-                    printf ("MPFR_EMIN_MIN");
1433-                  else if (e == emin)
1434-                    printf ("default emin");
1435-                  else if (e >= LONG_MIN)
1436-                    printf ("%ld", (long) e);
1437-                  else
1438-                    printf ("<LONG_MIN");
1439-                  printf (") with mpfr_%s,\nx = %d/16, prec = %d, k = %d, "
1440-                          "%s\n", div == 0 ? "mul_2si" : div == 1 ?
1441-                          "div_2si" : "div_2ui", i, prec, k,
1442-                          mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
1443-                  printf ("Expected ");
1444-                  mpfr_out_str (stdout, 16, 0, z1, MPFR_RNDN);
1445-                  printf (", inex = %d, flags = %u\n", SIGN (inex1), flags1);
1446-                  printf ("Got      ");
1447-                  mpfr_out_str (stdout, 16, 0, z2, MPFR_RNDN);
1448-                  printf (", inex = %d, flags = %u\n", SIGN (inex2), flags2);
1449-                  exit (1);
1450-                }  /* div */
1451-              }  /* k */
1452-          mpfr_clears (z1, z2, (mpfr_ptr) 0);
1453-        }  /* prec */
1454-    }  /* i */
1455+                  /* Do not use mpfr_div_ui to avoid the optimization
1456+                     by mpfr_div_2si. */
1457+                  inex1 = mpfr_div (z1, y, z1, (mpfr_rnd_t) rnd);
1458+                  flags1 = __gmpfr_flags;
1459+
1460+                  for (div = 0; div <= 2; div++)
1461+                    {
1462+                      mpfr_clear_flags ();
1463+                      inex2 =
1464+                        div == 0 ?
1465+                        mpfr_mul_2si (z2, x, e - k, (mpfr_rnd_t) rnd) :
1466+                        div == 1 ?
1467+                        mpfr_div_2si (z2, x, k - e, (mpfr_rnd_t) rnd) :
1468+                        mpfr_div_2ui (z2, x, k - e, (mpfr_rnd_t) rnd);
1469+                      flags2 = __gmpfr_flags;
1470+                      if (flags1 == flags2 && SAME_SIGN (inex1, inex2) &&
1471+                          mpfr_equal_p (z1, z2))
1472+                        continue;
1473+                      printf ("Error in underflow(");
1474+                      if (e == MPFR_EMIN_MIN)
1475+                        printf ("MPFR_EMIN_MIN");
1476+                      else if (e == emin)
1477+                        printf ("default emin");
1478+                      else if (e >= LONG_MIN)
1479+                        printf ("%ld", (long) e);
1480+                      else
1481+                        printf ("<LONG_MIN");
1482+                      printf (") with mpfr_%s,\nx = %d/16, prec = %d, k = %d,"
1483+                              " %s\n", div == 0 ? "mul_2si" : div == 1 ?
1484+                              "div_2si" : "div_2ui", s * i, prec, k,
1485+                              mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
1486+                      printf ("Expected ");
1487+                      mpfr_out_str (stdout, 16, 0, z1, MPFR_RNDN);
1488+                      printf (", inex = %d, flags = %u\n",
1489+                              SIGN (inex1), flags1);
1490+                      printf ("Got      ");
1491+                      mpfr_out_str (stdout, 16, 0, z2, MPFR_RNDN);
1492+                      printf (", inex = %d, flags = %u\n",
1493+                              SIGN (inex2), flags2);
1494+                      exit (1);
1495+                    }  /* div */
1496+                }  /* k */
1497+            mpfr_clears (z1, z2, (mpfr_ptr) 0);
1498+          }  /* prec */
1499+      }  /* i */
1500   mpfr_clears (x, y, (mpfr_ptr) 0);
1501   set_emin (emin);
1502 }
1503diff -Naurd mpfr-3.1.3-a/PATCHES mpfr-3.1.3-b/PATCHES
1504--- mpfr-3.1.3-a/PATCHES        2015-07-17 08:58:21.094987384 +0000
1505+++ mpfr-3.1.3-b/PATCHES        2015-07-17 08:58:21.118986898 +0000
1506@@ -0,0 +1 @@
1507+frexp
1508diff -Naurd mpfr-3.1.3-a/VERSION mpfr-3.1.3-b/VERSION
1509--- mpfr-3.1.3-a/VERSION        2015-07-17 08:54:48.616811495 +0000
1510+++ mpfr-3.1.3-b/VERSION        2015-07-17 08:58:21.118986898 +0000
1511@@ -1 +1 @@
1512-3.1.3-p3
1513+3.1.3-p4
1514diff -Naurd mpfr-3.1.3-a/src/frexp.c mpfr-3.1.3-b/src/frexp.c
1515--- mpfr-3.1.3-a/src/frexp.c    2015-06-19 19:55:09.000000000 +0000
1516+++ mpfr-3.1.3-b/src/frexp.c    2015-07-17 08:58:21.106987142 +0000
1517@@ -26,6 +26,13 @@
1518 mpfr_frexp (mpfr_exp_t *exp, mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
1519 {
1520   int inex;
1521+  unsigned int saved_flags = __gmpfr_flags;
1522+  MPFR_BLOCK_DECL (flags);
1523+
1524+  MPFR_LOG_FUNC
1525+    (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
1526+     ("y[%Pu]=%.*Rg exp=%" MPFR_EXP_FSPEC "d inex=%d", mpfr_get_prec (y),
1527+      mpfr_log_prec, y, (mpfr_eexp_t) *exp, inex));
1528 
1529   if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x)))
1530     {
1531@@ -49,8 +56,32 @@
1532         }
1533     }
1534 
1535-  inex = mpfr_set (y, x, rnd);
1536+  MPFR_BLOCK (flags, inex = mpfr_set (y, x, rnd));
1537+  __gmpfr_flags = saved_flags;
1538+
1539+  /* Possible overflow due to the rounding, no possible underflow. */
1540+
1541+  if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags)))
1542+    {
1543+      int inex2;
1544+
1545+      /* An overflow here means that the exponent of y would be larger than
1546+         the one of x, thus x would be rounded to the next power of 2, and
1547+         the returned y should be 1/2 in absolute value, rounded (i.e. with
1548+         possible underflow or overflow). This also implies that x and y are
1549+         different objects, so that the exponent of x has not been lost. */
1550+      MPFR_LOG_MSG (("Internal overflow\n", 0));
1551+      MPFR_ASSERTD (x != y);
1552+      *exp = MPFR_GET_EXP (x) + 1;
1553+      inex2 = mpfr_set_si_2exp (y, MPFR_INT_SIGN (x), -1, rnd);
1554+      MPFR_LOG_MSG (("inex=%d inex2=%d\n", inex, inex2));
1555+      if (inex2 != 0)
1556+        inex = inex2;
1557+      MPFR_RET (inex);
1558+    }
1559+
1560   *exp = MPFR_GET_EXP (y);
1561-  MPFR_SET_EXP (y, 0);
1562+  /* Do not use MPFR_SET_EXP because the range has not been checked yet. */
1563+  MPFR_EXP (y) = 0;
1564   return mpfr_check_range (y, inex, rnd);
1565 }
1566diff -Naurd mpfr-3.1.3-a/src/mpfr.h mpfr-3.1.3-b/src/mpfr.h
1567--- mpfr-3.1.3-a/src/mpfr.h     2015-07-17 08:54:48.616811495 +0000
1568+++ mpfr-3.1.3-b/src/mpfr.h     2015-07-17 08:58:21.114986979 +0000
1569@@ -27,7 +27,7 @@
1570 #define MPFR_VERSION_MAJOR 3
1571 #define MPFR_VERSION_MINOR 1
1572 #define MPFR_VERSION_PATCHLEVEL 3
1573-#define MPFR_VERSION_STRING "3.1.3-p3"
1574+#define MPFR_VERSION_STRING "3.1.3-p4"
1575 
1576 /* Macros dealing with MPFR VERSION */
1577 #define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
1578diff -Naurd mpfr-3.1.3-a/src/version.c mpfr-3.1.3-b/src/version.c
1579--- mpfr-3.1.3-a/src/version.c  2015-07-17 08:54:48.616811495 +0000
1580+++ mpfr-3.1.3-b/src/version.c  2015-07-17 08:58:21.118986898 +0000
1581@@ -25,5 +25,5 @@
1582 const char *
1583 mpfr_get_version (void)
1584 {
1585-  return "3.1.3-p3";
1586+  return "3.1.3-p4";
1587 }
1588diff -Naurd mpfr-3.1.3-a/tests/tfrexp.c mpfr-3.1.3-b/tests/tfrexp.c
1589--- mpfr-3.1.3-a/tests/tfrexp.c 2015-06-19 19:55:10.000000000 +0000
1590+++ mpfr-3.1.3-b/tests/tfrexp.c 2015-07-17 08:58:21.106987142 +0000
1591@@ -129,12 +129,115 @@
1592   mpfr_clear (x);
1593 }
1594 
1595+static void check1 (void)
1596+{
1597+  mpfr_exp_t emin, emax, e;
1598+  mpfr_t x, y1, y2;
1599+  int r, neg, red;
1600+
1601+  emin = mpfr_get_emin ();
1602+  emax = mpfr_get_emax ();
1603+  set_emin (MPFR_EMIN_MIN);
1604+  set_emax (MPFR_EMAX_MAX);
1605+
1606+  mpfr_init2 (x, 7);
1607+  mpfr_inits2 (4, y1, y2, (mpfr_ptr) 0);
1608+
1609+  mpfr_set_ui_2exp (x, 1, -2, MPFR_RNDN);
1610+  while (mpfr_regular_p (x))
1611+    {
1612+      /* Test the exponents up to 3 and with the maximum exponent
1613+         (to check potential intermediate overflow). */
1614+      if (MPFR_GET_EXP (x) == 4)
1615+        mpfr_set_exp (x, MPFR_EMAX_MAX);
1616+      e = MPFR_GET_EXP (x);
1617+      for (neg = 0; neg < 2; neg++)
1618+        {
1619+          RND_LOOP (r)
1620+            {
1621+              int inex1, inex2;
1622+              mpfr_exp_t e1, e2;
1623+              unsigned int flags1, flags2;
1624+
1625+              for (red = 0; red < 2; red++)
1626+                {
1627+                  if (red)
1628+                    {
1629+                      /* e1: exponent of the rounded value of x. */
1630+                      MPFR_ASSERTN (e1 == e || e1 == e + 1);
1631+                      set_emin (e);
1632+                      set_emax (e);
1633+                      mpfr_clear_flags ();
1634+                      inex1 = e1 < 0 ?
1635+                        mpfr_mul_2ui (y1, x, -e1, (mpfr_rnd_t) r) :
1636+                        mpfr_div_2ui (y1, x, e1, (mpfr_rnd_t) r);
1637+                      flags1 = __gmpfr_flags;
1638+                    }
1639+                  else
1640+                    {
1641+                      inex1 = mpfr_set (y1, x, (mpfr_rnd_t) r);
1642+                      e1 = MPFR_IS_INF (y1) ? e + 1 : MPFR_GET_EXP (y1);
1643+                      flags1 = inex1 != 0 ? MPFR_FLAGS_INEXACT : 0;
1644+                    }
1645+                  mpfr_clear_flags ();
1646+                  inex2 = mpfr_frexp (&e2, y2, x, (mpfr_rnd_t) r);
1647+                  flags2 = __gmpfr_flags;
1648+                  set_emin (MPFR_EMIN_MIN);
1649+                  set_emax (MPFR_EMAX_MAX);
1650+                  if ((!red || e == 0) &&
1651+                      (! mpfr_regular_p (y2) || MPFR_GET_EXP (y2) != 0))
1652+                    {
1653+                      printf ("Error in check1 for %s, red = %d, x = ",
1654+                              mpfr_print_rnd_mode ((mpfr_rnd_t) r), red);
1655+                      mpfr_dump (x);
1656+                      printf ("Expected 1/2 <= |y| < 1, got y = ");
1657+                      mpfr_dump (y2);
1658+                      exit (1);
1659+                    }
1660+                  if (!red)
1661+                    {
1662+                      if (e2 > 0)
1663+                        mpfr_mul_2ui (y2, y2, e2, MPFR_RNDN);
1664+                      else if (e2 < 0)
1665+                        mpfr_div_2ui (y2, y2, -e2, MPFR_RNDN);
1666+                    }
1667+                  if (! (SAME_SIGN (inex1, inex2) &&
1668+                         mpfr_equal_p (y1, y2) &&
1669+                         flags1 == flags2))
1670+                    {
1671+                      printf ("Error in check1 for %s, red = %d, x = ",
1672+                              mpfr_print_rnd_mode ((mpfr_rnd_t) r), red);
1673+                      mpfr_dump (x);
1674+                      printf ("Expected y1 = ");
1675+                      mpfr_dump (y1);
1676+                      printf ("Got      y2 = ");
1677+                      mpfr_dump (y2);
1678+                      printf ("Expected inex ~= %d, got %d\n", inex1, inex2);
1679+                      printf ("Expected flags:");
1680+                      flags_out (flags1);
1681+                      printf ("Got flags:     ");
1682+                      flags_out (flags2);
1683+                      exit (1);
1684+                    }
1685+                }
1686+            }
1687+          mpfr_neg (x, x, MPFR_RNDN);
1688+        }
1689+      mpfr_nextabove (x);
1690+    }
1691+
1692+  mpfr_clears (x, y1, y2, (mpfr_ptr) 0);
1693+  set_emin (emin);
1694+  set_emax (emax);
1695+}
1696+
1697 int
1698 main (int argc, char *argv[])
1699 {
1700   tests_start_mpfr ();
1701 
1702   check_special ();
1703+  check1 ();
1704 
1705   tests_end_mpfr ();
1706   return 0;
Note: See TracBrowser for help on using the repository browser.