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

systemd
Last change on this file since d75d083 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
  • mpfr-3.1.

    Submitted By: William Harrington (kb0iic at cross-lfs dot org)
    Date: 2015-08-18
    Initial Package Version: 3.1.3
    Origin: Upstream
    Upstream Status: Applied
    Description: Contains all upstream patches of mpfr current to patch level 4.
    
    diff -Naurd mpfr-3.1.3-a/PATCHES mpfr-3.1.3-b/PATCHES
    old new  
     1lngamma-and-doc
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.3-a/VERSION mpfr-3.1.3-b/VERSION
    old new  
    1 3.1.3
     13.1.3-p1
  • doc/mpfr.texi

    diff -Naurd mpfr-3.1.3-a/doc/mpfr.texi mpfr-3.1.3-b/doc/mpfr.texi
    old new  
    810810When the input point is in the closure of the domain of the mathematical
    811811function and an input argument is +0 (resp.@: @minus{}0), one considers
    812812the limit when the corresponding argument approaches 0 from above
    813 (resp.@: below). If the limit is not defined (e.g., @code{mpfr_log} on
    814 @minus{}0), the behavior is specified in the description of the MPFR function.
     813(resp.@: below), if possible. If the limit is not defined (e.g.,
     814@code{mpfr_sqrt} and @code{mpfr_log} on @minus{}0), the behavior is
     815specified in the description of the MPFR function, but must be consistent
     816with the rule from the above paragraph (e.g., @code{mpfr_log} on @pom{}0
     817gives @minus{}Inf).
    815818
    816819When the result is equal to 0, its sign is determined by considering the
    817820limit as if the input point were not in the domain: If one approaches 0
    818821from above (resp.@: below), the result is +0 (resp.@: @minus{}0);
    819 for example, @code{mpfr_sin} on +0 gives +0.
     822for example, @code{mpfr_sin} on @minus{}0 gives @minus{}0 and
     823@code{mpfr_acos} on 1 gives +0 (in all rounding modes).
    820824In the other cases, the sign is specified in the description of the MPFR
    821825function; for example @code{mpfr_max} on @minus{}0 and +0 gives +0.
    822826
     
    832836@c that advantages in practice), like for any bug fix.
    833837Example: @code{mpfr_hypot} on (NaN,0) gives NaN, but @code{mpfr_hypot}
    834838on (NaN,+Inf) gives +Inf (as specified in @ref{Special Functions}),
    835 since for any finite input @var{x}, @code{mpfr_hypot} on (@var{x},+Inf)
    836 gives +Inf.
     839since for any finite or infinite input @var{x}, @code{mpfr_hypot} on
     840(@var{x},+Inf) gives +Inf.
    837841
    838842@node Exceptions, Memory Handling, Floating-Point Values on Special Numbers, MPFR Basics
    839843@comment  node-name,  next,  previous,  up
     
    15811585@deftypefunx int mpfr_add_z (mpfr_t @var{rop}, mpfr_t @var{op1}, mpz_t @var{op2}, mpfr_rnd_t @var{rnd})
    15821586@deftypefunx int mpfr_add_q (mpfr_t @var{rop}, mpfr_t @var{op1}, mpq_t @var{op2}, mpfr_rnd_t @var{rnd})
    15831587Set @var{rop} to @math{@var{op1} + @var{op2}} rounded in the direction
    1584 @var{rnd}. For types having no signed zero, it is considered unsigned
     1588@var{rnd}.  The IEEE-754 rules are used, in particular for signed zeros.
     1589But for types having no signed zeros, 0 is considered unsigned
    15851590(i.e., (+0) + 0 = (+0) and (@minus{}0) + 0 = (@minus{}0)).
    15861591The @code{mpfr_add_d} function assumes that the radix of the @code{double} type
    15871592is a power of 2, with a precision at most that declared by the C implementation
     
    15991604@deftypefunx int mpfr_sub_z (mpfr_t @var{rop}, mpfr_t @var{op1}, mpz_t @var{op2}, mpfr_rnd_t @var{rnd})
    16001605@deftypefunx int mpfr_sub_q (mpfr_t @var{rop}, mpfr_t @var{op1}, mpq_t @var{op2}, mpfr_rnd_t @var{rnd})
    16011606Set @var{rop} to @math{@var{op1} - @var{op2}} rounded in the direction
    1602 @var{rnd}. For types having no signed zero, it is considered unsigned
     1607@var{rnd}.  The IEEE-754 rules are used, in particular for signed zeros.
     1608But for types having no signed zeros, 0 is considered unsigned
    16031609(i.e., (+0) @minus{} 0 = (+0), (@minus{}0) @minus{} 0 = (@minus{}0),
    160416100 @minus{} (+0) = (@minus{}0) and 0 @minus{} (@minus{}0) = (+0)).
    16051611The same restrictions than for @code{mpfr_add_d} apply to @code{mpfr_d_sub}
     
    16151621Set @var{rop} to @math{@var{op1} @GMPtimes{} @var{op2}} rounded in the
    16161622direction @var{rnd}.
    16171623When a result is zero, its sign is the product of the signs of the operands
    1618 (for types having no signed zero, it is considered positive).
     1624(for types having no signed zeros, 0 is considered positive).
    16191625The same restrictions than for @code{mpfr_add_d} apply to @code{mpfr_mul_d}.
    16201626@end deftypefun
    16211627
     
    16351641@deftypefunx int mpfr_div_q (mpfr_t @var{rop}, mpfr_t @var{op1}, mpq_t @var{op2}, mpfr_rnd_t @var{rnd})
    16361642Set @var{rop} to @math{@var{op1}/@var{op2}} rounded in the direction @var{rnd}.
    16371643When a result is zero, its sign is the product of the signs of the operands
    1638 (for types having no signed zero, it is considered positive).
     1644(for types having no signed zeros, 0 is considered positive).
    16391645The same restrictions than for @code{mpfr_add_d} apply to @code{mpfr_d_div}
    16401646and @code{mpfr_div_d}.
    16411647@end deftypefun
     
    16431649@deftypefun int mpfr_sqrt (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
    16441650@deftypefunx int mpfr_sqrt_ui (mpfr_t @var{rop}, unsigned long int @var{op}, mpfr_rnd_t @var{rnd})
    16451651Set @var{rop} to @m{\sqrt{@var{op}}, the square root of @var{op}}
    1646 rounded in the direction @var{rnd} (set @var{rop} to @minus{}0 if @var{op} is
    1647 @minus{}0, to be consistent with the IEEE 754 standard).
     1652rounded in the direction @var{rnd}.  Set @var{rop} to @minus{}0 if
     1653@var{op} is @minus{}0, to be consistent with the IEEE 754 standard.
    16481654Set @var{rop} to NaN if @var{op} is negative.
    16491655@end deftypefun
    16501656
    16511657@deftypefun int mpfr_rec_sqrt (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
    16521658Set @var{rop} to @m{1/\sqrt{@var{op}}, the reciprocal square root of @var{op}}
    1653 rounded in the direction @var{rnd}. Set @var{rop} to +Inf if @var{op} is
    1654 @pom{}0, +0 if @var{op} is +Inf, and NaN if @var{op} is negative.
     1659rounded in the direction @var{rnd}.  Set @var{rop} to +Inf if @var{op} is
     1660@pom{}0, +0 if @var{op} is +Inf, and NaN if @var{op} is negative.  Warning!
     1661Therefore the result on @minus{}0 is different from the one of the rSqrt
     1662function recommended by the IEEE 754-2008 standard (Section 9.2.1), which
     1663is @minus{}Inf instead of +Inf.
    16551664@end deftypefun
    16561665
    16571666@deftypefun int mpfr_cbrt (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
     
    18321841@m{\log_2 @var{op}, log2(@var{op})} or
    18331842@m{\log_{10} @var{op}, log10(@var{op})}, respectively,
    18341843rounded in the direction @var{rnd}.
    1835 Set @var{rop} to @minus{}Inf if @var{op} is @minus{}0
     1844Set @var{rop} to +0 if @var{op} is 1 (in all rounding modes),
     1845for consistency with the ISO C99 and IEEE 754-2008 standards.
     1846Set @var{rop} to @minus{}Inf if @var{op} is @pom{}0
    18361847(i.e., the sign of the zero has no influence on the result).
    18371848@end deftypefun
    18381849
     
    20032014@deftypefun int mpfr_lngamma (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
    20042015Set @var{rop} to the value of the logarithm of the Gamma function on @var{op},
    20052016rounded in the direction @var{rnd}.
    2006 When @math{@minus{}2@var{k}@minus{}1 @le{} @var{op} @le{} @minus{}2@var{k}},
    2007 @var{k} being a non-negative integer, @var{rop} is set to NaN.
     2017When @var{op} is 1 or 2, set @var{rop} to +0 (in all rounding modes).
     2018When @var{op} is an infinity or a nonpositive integer, set @var{rop} to +Inf,
     2019following the general rules on special values.
     2020When @math{@minus{}2@var{k}@minus{}1 < @var{op} < @minus{}2@var{k}},
     2021@var{k} being a nonnegative integer, set @var{rop} to NaN@.
    20082022See also @code{mpfr_lgamma}.
    20092023@end deftypefun
    20102024
     
    20122026Set @var{rop} to the value of the logarithm of the absolute value of the
    20132027Gamma function on @var{op}, rounded in the direction @var{rnd}. The sign
    20142028(1 or @minus{}1) of Gamma(@var{op}) is returned in the object pointed to
    2015 by @var{signp}. When @var{op} is an infinity or a non-positive integer, set
    2016 @var{rop} to +Inf. When @var{op} is NaN, @minus{}Inf or a negative integer,
    2017 *@var{signp} is undefined, and when @var{op} is @pom{}0, *@var{signp} is
    2018 the sign of the zero.
     2029by @var{signp}.
     2030When @var{op} is 1 or 2, set @var{rop} to +0 (in all rounding modes).
     2031When @var{op} is an infinity or a nonpositive integer, set @var{rop} to +Inf.
     2032When @var{op} is NaN, @minus{}Inf or a negative integer, *@var{signp} is
     2033undefined, and when @var{op} is @pom{}0, *@var{signp} is the sign of the zero.
    20192034@end deftypefun
    20202035
    20212036@deftypefun int mpfr_digamma (mpfr_t @var{rop}, mpfr_t @var{op}, mpfr_rnd_t @var{rnd})
     
    20642079@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})
    20652080Set @var{rop} to @math{(@var{op1} @GMPtimes{} @var{op2}) + @var{op3}}
    20662081(resp.@: @math{(@var{op1} @GMPtimes{} @var{op2}) - @var{op3}})
    2067 rounded in the direction @var{rnd}.
     2082rounded in the direction @var{rnd}.  Concerning special values (signed zeros,
     2083infinities, NaN), these functions behave like a multiplication followed by a
     2084separate addition or subtraction.  That is, the fused operation matters only
     2085for rounding.
    20682086@end deftypefun
    20692087
    20702088@deftypefun int mpfr_agm (mpfr_t @var{rop}, mpfr_t @var{op1}, mpfr_t @var{op2}, mpfr_rnd_t @var{rnd})
     
    20892107i.e., $\sqrt{x^2+y^2}$,
    20902108@end tex
    20912109rounded in the direction @var{rnd}.
    2092 Special values are handled as described in Section F.9.4.3 of
    2093 the ISO C99 and IEEE 754-2008 standards:
     2110Special values are handled as described in the ISO C99 (Section F.9.4.3)
     2111and IEEE 754-2008 (Section 9.2.1) standards:
    20942112If @var{x} or @var{y} is an infinity, then +Inf is returned in @var{rop},
    20952113even if the other number is NaN.
    20962114@end deftypefun
  • doc/mpfr.info

    diff -Naurd mpfr-3.1.3-a/doc/mpfr.info mpfr-3.1.3-b/doc/mpfr.info
    old new  
    1 This is mpfr.info, produced by makeinfo version 5.2 from mpfr.texi.
     1This is mpfr.info, produced by makeinfo version 6.0 from mpfr.texi.
    22
    33This manual documents how to install and use the Multiple Precision
    44Floating-Point Reliable Library, version 3.1.3.
     
    5555MPFR Copying Conditions
    5656***********************
    5757
    58 The GNU MPFR library (or MPFR for short) is "free"; this means that
     58The GNU MPFR library (or MPFR for short) is “free”; this means that
    5959everyone is free to use it and free to redistribute it on a free basis.
    6060The library is not in the public domain; it is copyrighted and there are
    6161restrictions on its distribution, but these restrictions are designed to
     
    4184184.2 Nomenclature and Types
    419419==========================
    420420
    421 A "floating-point number", or "float" for short, is an arbitrary
     421A “floating-point number”, or “float” for short, is an arbitrary
    422422precision significand (also called mantissa) with a limited precision
    423423exponent.  The C data type for such objects is ‘mpfr_t’ (internally
    424424defined as a one-element array of a structure, and ‘mpfr_ptr’ is the C
     
    432432to the other functions supported by MPFR. Unless documented otherwise,
    433433the sign bit of a NaN is unspecified.
    434434
    435 The "precision" is the number of bits used to represent the significand
     435The “precision” is the number of bits used to represent the significand
    436436of a floating-point number; the corresponding C data type is
    437437‘mpfr_prec_t’.  The precision can be any integer between ‘MPFR_PREC_MIN’
    438438and ‘MPFR_PREC_MAX’.  In the current implementation, ‘MPFR_PREC_MIN’ is
     
    446446may abort, crash or have undefined behavior (depending on your C
    447447implementation).
    448448
    449 The "rounding mode" specifies the way to round the result of a
     449The “rounding mode” specifies the way to round the result of a
    450450floating-point operation, in case the exact result can not be
    451451represented exactly in the destination significand; the corresponding C
    452452data type is ‘mpfr_rnd_t’.
     
    499499representable numbers, it is rounded to the one with the least
    500500significant bit set to zero.  For example, the number 2.5, which is
    501501represented by (10.1) in binary, is rounded to (10.0)=2 with a precision
    502 of two bits, and not to (11.0)=3.  This rule avoids the "drift"
     502of two bits, and not to (11.0)=3.  This rule avoids the “drift”
    503503phenomenon mentioned by Knuth in volume 2 of The Art of Computer
    504504Programming (Section 4.2.2).
    505505
    506506   Most MPFR functions take as first argument the destination variable,
    507507as second and following arguments the input variables, as last argument
    508508a rounding mode, and have a return value of type ‘int’, called the
    509 "ternary value".  The value stored in the destination variable is
     509“ternary value”.  The value stored in the destination variable is
    510510correctly rounded, i.e., MPFR behaves as if it computed the result with
    511511an infinite precision, then rounded it to the precision of this
    512512variable.  The input variables are regarded as exact (in particular,
     
    572572   When the input point is in the closure of the domain of the
    573573mathematical function and an input argument is +0 (resp. −0), one
    574574considers the limit when the corresponding argument approaches 0 from
    575 above (resp. below).  If the limit is not defined (e.g., ‘mpfr_log’ on
    576 âˆ’0), the behavior is specified in the description of the MPFR function.
     575above (resp. below), if possible.  If the limit is not defined (e.g.,
     576‘mpfr_sqrt’ and ‘mpfr_log’ on −0), the behavior is specified in the
     577description of the MPFR function, but must be consistent with the rule
     578from the above paragraph (e.g., ‘mpfr_log’ on ±0 gives −Inf).
    577579
    578580   When the result is equal to 0, its sign is determined by considering
    579581the limit as if the input point were not in the domain: If one
    580582approaches 0 from above (resp. below), the result is +0 (resp. −0); for
    581 example, ‘mpfr_sin’ on +0 gives +0.  In the other cases, the sign is
    582 specified in the description of the MPFR function; for example
    583 â€˜mpfr_max’ on −0 and +0 gives +0.
     583example, ‘mpfr_sin’ on −0 gives −0 and ‘mpfr_acos’ on 1 gives +0 (in all
     584rounding modes).  In the other cases, the sign is specified in the
     585description of the MPFR function; for example ‘mpfr_max’ on −0 and +0
     586gives +0.
    584587
    585588   When the input point is not in the closure of the domain of the
    586589function, the result is NaN. Example: ‘mpfr_sqrt’ on −17 gives NaN.
     
    590593numbers; such a case is always explicitly specified in *note MPFR
    591594Interface::.  Example: ‘mpfr_hypot’ on (NaN,0) gives NaN, but
    592595‘mpfr_hypot’ on (NaN,+Inf) gives +Inf (as specified in *note Special
    593 Functions::), since for any finite input X, ‘mpfr_hypot’ on (X,+Inf)
    594 gives +Inf.
     596Functions::), since for any finite or infinite input X, ‘mpfr_hypot’ on
     597(X,+Inf) gives +Inf.
    595598
    596599
    597600File: mpfr.info,  Node: Exceptions,  Next: Memory Handling,  Prev: Floating-Point Values on Special Numbers,  Up: MPFR Basics
     
    12531256          mpfr_rnd_t RND)
    12541257 -- Function: int mpfr_add_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
    12551258          mpfr_rnd_t RND)
    1256      Set ROP to OP1 + OP2 rounded in the direction RND.  For types
    1257      having no signed zero, it is considered unsigned (i.e., (+0) + 0 =
     1259     Set ROP to OP1 + OP2 rounded in the direction RND.  The IEEE-754
     1260     rules are used, in particular for signed zeros.  But for types
     1261     having no signed zeros, 0 is considered unsigned (i.e., (+0) + 0 =
    12581262     (+0) and (−0) + 0 = (−0)).  The ‘mpfr_add_d’ function assumes that
    12591263     the radix of the ‘double’ type is a power of 2, with a precision at
    12601264     most that declared by the C implementation (macro
     
    12801284          mpfr_rnd_t RND)
    12811285 -- Function: int mpfr_sub_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
    12821286          mpfr_rnd_t RND)
    1283      Set ROP to OP1 - OP2 rounded in the direction RND.  For types
    1284      having no signed zero, it is considered unsigned (i.e., (+0) − 0 =
     1287     Set ROP to OP1 - OP2 rounded in the direction RND.  The IEEE-754
     1288     rules are used, in particular for signed zeros.  But for types
     1289     having no signed zeros, 0 is considered unsigned (i.e., (+0) − 0 =
    12851290     (+0), (−0) − 0 = (−0), 0 − (+0) = (−0) and 0 − (−0) = (+0)).  The
    12861291     same restrictions than for ‘mpfr_add_d’ apply to ‘mpfr_d_sub’ and
    12871292     â€˜mpfr_sub_d’.
     
    13001305          mpfr_rnd_t RND)
    13011306     Set ROP to OP1 times OP2 rounded in the direction RND.  When a
    13021307     result is zero, its sign is the product of the signs of the
    1303      operands (for types having no signed zero, it is considered
     1308     operands (for types having no signed zeros, 0 is considered
    13041309     positive).  The same restrictions than for ‘mpfr_add_d’ apply to
    13051310     â€˜mpfr_mul_d’.
    13061311
     
    13271332          mpfr_rnd_t RND)
    13281333     Set ROP to OP1/OP2 rounded in the direction RND.  When a result is
    13291334     zero, its sign is the product of the signs of the operands (for
    1330      types having no signed zero, it is considered positive).  The same
     1335     types having no signed zeros, 0 is considered positive).  The same
    13311336     restrictions than for ‘mpfr_add_d’ apply to ‘mpfr_d_div’ and
    13321337     â€˜mpfr_div_d’.
    13331338
    13341339 -- Function: int mpfr_sqrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
    13351340 -- Function: int mpfr_sqrt_ui (mpfr_t ROP, unsigned long int OP,
    13361341          mpfr_rnd_t RND)
    1337      Set ROP to the square root of OP rounded in the direction RND (set
    1338      ROP to −0 if OP is −0, to be consistent with the IEEE 754
    1339      standard).  Set ROP to NaN if OP is negative.
     1342     Set ROP to the square root of OP rounded in the direction RND.  Set
     1343     ROP to −0 if OP is −0, to be consistent with the IEEE 754 standard.
     1344     Set ROP to NaN if OP is negative.
    13401345
    13411346 -- Function: int mpfr_rec_sqrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
    13421347     Set ROP to the reciprocal square root of OP rounded in the
    13431348     direction RND.  Set ROP to +Inf if OP is ±0, +0 if OP is +Inf, and
    1344      NaN if OP is negative.
     1349     NaN if OP is negative.  Warning!  Therefore the result on −0 is
     1350     different from the one of the rSqrt function recommended by the
     1351     IEEE 754-2008 standard (Section 9.2.1), which is −Inf instead of
     1352     +Inf.
    13451353
    13461354 -- Function: int mpfr_cbrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
    13471355 -- Function: int mpfr_root (mpfr_t ROP, mpfr_t OP, unsigned long int K,
     
    15151523 -- Function: int mpfr_log2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
    15161524 -- Function: int mpfr_log10 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
    15171525     Set ROP to the natural logarithm of OP, log2(OP) or log10(OP),
    1518      respectively, rounded in the direction RND.  Set ROP to −Inf if OP
    1519      is −0 (i.e., the sign of the zero has no influence on the result).
     1526     respectively, rounded in the direction RND.  Set ROP to +0 if OP is
     1527     1 (in all rounding modes), for consistency with the ISO C99 and
     1528     IEEE 754-2008 standards.  Set ROP to −Inf if OP is ±0 (i.e., the
     1529     sign of the zero has no influence on the result).
    15201530
    15211531 -- Function: int mpfr_exp (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
    15221532 -- Function: int mpfr_exp2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
     
    16491659
    16501660 -- Function: int mpfr_lngamma (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
    16511661     Set ROP to the value of the logarithm of the Gamma function on OP,
    1652      rounded in the direction RND.  When −2K−1 <= OP <= −2K, K being a
    1653      non-negative integer, ROP is set to NaN. See also ‘mpfr_lgamma’.
     1662     rounded in the direction RND.  When OP is 1 or 2, set ROP to +0 (in
     1663     all rounding modes).  When OP is an infinity or a nonpositive
     1664     integer, set ROP to +Inf, following the general rules on special
     1665     values.  When −2K−1 < OP < −2K, K being a nonnegative integer, set
     1666     ROP to NaN.  See also ‘mpfr_lgamma’.
    16541667
    16551668 -- Function: int mpfr_lgamma (mpfr_t ROP, int *SIGNP, mpfr_t OP,
    16561669          mpfr_rnd_t RND)
    16571670     Set ROP to the value of the logarithm of the absolute value of the
    16581671     Gamma function on OP, rounded in the direction RND.  The sign (1 or
    16591672     âˆ’1) of Gamma(OP) is returned in the object pointed to by SIGNP.
    1660      When OP is an infinity or a non-positive integer, set ROP to +Inf.
    1661      When OP is NaN, −Inf or a negative integer, *SIGNP is undefined,
    1662      and when OP is ±0, *SIGNP is the sign of the zero.
     1673     When OP is 1 or 2, set ROP to +0 (in all rounding modes).  When OP
     1674     is an infinity or a nonpositive integer, set ROP to +Inf.  When OP
     1675     is NaN, −Inf or a negative integer, *SIGNP is undefined, and when
     1676     OP is ±0, *SIGNP is the sign of the zero.
    16631677
    16641678 -- Function: int mpfr_digamma (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
    16651679     Set ROP to the value of the Digamma (sometimes also called Psi)
     
    17031717 -- Function: int mpfr_fms (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_t
    17041718          OP3, mpfr_rnd_t RND)
    17051719     Set ROP to (OP1 times OP2) + OP3 (resp. (OP1 times OP2) - OP3)
    1706      rounded in the direction RND.
     1720     rounded in the direction RND.  Concerning special values (signed
     1721     zeros, infinities, NaN), these functions behave like a
     1722     multiplication followed by a separate addition or subtraction.
     1723     That is, the fused operation matters only for rounding.
    17071724
    17081725 -- Function: int mpfr_agm (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
    17091726          mpfr_rnd_t RND)
     
    17171734          RND)
    17181735     Set ROP to the Euclidean norm of X and Y, i.e., the square root of
    17191736     the sum of the squares of X and Y, rounded in the direction RND.
    1720      Special values are handled as described in Section F.9.4.3 of the
    1721      ISO C99 and IEEE 754-2008 standards: If X or Y is an infinity, then
    1722      +Inf is returned in ROP, even if the other number is NaN.
     1737     Special values are handled as described in the ISO C99 (Section
     1738     F.9.4.3) and IEEE 754-2008 (Section 9.2.1) standards: If X or Y is
     1739     an infinity, then +Inf is returned in ROP, even if the other number
     1740     is NaN.
    17231741
    17241742 -- Function: int mpfr_ai (mpfr_t ROP, mpfr_t X, mpfr_rnd_t RND)
    17251743     Set ROP to the value of the Airy function Ai on X, rounded in the
     
    267026885.16 Internals
    26712689==============
    26722690
    2673 A "limb" means the part of a multi-precision number that fits in a
     2691A “limb” means the part of a multi-precision number that fits in a
    26742692single word.  Usually a limb contains 32 or 64 bits.  The C data type
    26752693for a limb is ‘mp_limb_t’.
    26762694
     
    31403158  0. PREAMBLE
    31413159
    31423160     The purpose of this License is to make a manual, textbook, or other
    3143      functional and useful document "free" in the sense of freedom: to
     3161     functional and useful document “free” in the sense of freedom: to
    31443162     assure everyone the effective freedom to copy and redistribute it,
    31453163     with or without modifying it, either commercially or
    31463164     noncommercially.  Secondarily, this License preserves for the
     
    36553673* Menu:
    36563674
    36573675* mpfr_abs:                              Basic Arithmetic Functions.
    3658                                                               (line 160)
    3659 * mpfr_acos:                             Special Functions.   (line  51)
    3660 * mpfr_acosh:                            Special Functions.   (line 115)
     3676                                                              (line 165)
     3677* mpfr_acos:                             Special Functions.   (line  53)
     3678* mpfr_acosh:                            Special Functions.   (line 117)
    36613679* mpfr_add:                              Basic Arithmetic Functions.
    36623680                                                              (line   6)
    36633681* mpfr_add_d:                            Basic Arithmetic Functions.
     
    36703688                                                              (line   8)
    36713689* mpfr_add_z:                            Basic Arithmetic Functions.
    36723690                                                              (line  14)
    3673 * mpfr_agm:                              Special Functions.   (line 210)
    3674 * mpfr_ai:                               Special Functions.   (line 226)
    3675 * mpfr_asin:                             Special Functions.   (line  52)
    3676 * mpfr_asinh:                            Special Functions.   (line 116)
     3691* mpfr_agm:                              Special Functions.   (line 219)
     3692* mpfr_ai:                               Special Functions.   (line 236)
     3693* mpfr_asin:                             Special Functions.   (line  54)
     3694* mpfr_asinh:                            Special Functions.   (line 118)
    36773695* mpfr_asprintf:                         Formatted Output Functions.
    36783696                                                              (line 193)
    3679 * mpfr_atan:                             Special Functions.   (line  53)
    3680 * mpfr_atan2:                            Special Functions.   (line  63)
    3681 * mpfr_atanh:                            Special Functions.   (line 117)
     3697* mpfr_atan:                             Special Functions.   (line  55)
     3698* mpfr_atan2:                            Special Functions.   (line  65)
     3699* mpfr_atanh:                            Special Functions.   (line 119)
    36823700* mpfr_buildopt_decimal_p:               Miscellaneous Functions.
    36833701                                                              (line 162)
    36843702* mpfr_buildopt_gmpinternals_p:          Miscellaneous Functions.
     
    36903708* mpfr_can_round:                        Rounding Related Functions.
    36913709                                                              (line  39)
    36923710* mpfr_cbrt:                             Basic Arithmetic Functions.
    3693                                                               (line 108)
     3711                                                              (line 113)
    36943712* mpfr_ceil:                             Integer Related Functions.
    36953713                                                              (line   7)
    36963714* mpfr_check_range:                      Exception Related Functions.
     
    37353753                                                              (line  27)
    37363754* mpfr_cmp_z:                            Comparison Functions.
    37373755                                                              (line  11)
    3738 * mpfr_const_catalan:                    Special Functions.   (line 237)
    3739 * mpfr_const_euler:                      Special Functions.   (line 236)
    3740 * mpfr_const_log2:                       Special Functions.   (line 234)
    3741 * mpfr_const_pi:                         Special Functions.   (line 235)
     3756* mpfr_const_catalan:                    Special Functions.   (line 247)
     3757* mpfr_const_euler:                      Special Functions.   (line 246)
     3758* mpfr_const_log2:                       Special Functions.   (line 244)
     3759* mpfr_const_pi:                         Special Functions.   (line 245)
    37423760* mpfr_copysign:                         Miscellaneous Functions.
    37433761                                                              (line 109)
    3744 * mpfr_cos:                              Special Functions.   (line  29)
    3745 * mpfr_cosh:                             Special Functions.   (line  95)
    3746 * mpfr_cot:                              Special Functions.   (line  47)
    3747 * mpfr_coth:                             Special Functions.   (line 111)
    3748 * mpfr_csc:                              Special Functions.   (line  46)
    3749 * mpfr_csch:                             Special Functions.   (line 110)
     3762* mpfr_cos:                              Special Functions.   (line  31)
     3763* mpfr_cosh:                             Special Functions.   (line  97)
     3764* mpfr_cot:                              Special Functions.   (line  49)
     3765* mpfr_coth:                             Special Functions.   (line 113)
     3766* mpfr_csc:                              Special Functions.   (line  48)
     3767* mpfr_csch:                             Special Functions.   (line 112)
    37503768* mpfr_custom_get_exp:                   Custom Interface.    (line  75)
    37513769* mpfr_custom_get_kind:                  Custom Interface.    (line  65)
    37523770* mpfr_custom_get_significand:           Custom Interface.    (line  70)
     
    37563774* mpfr_custom_move:                      Custom Interface.    (line  82)
    37573775* MPFR_DECL_INIT:                        Initialization Functions.
    37583776                                                              (line  74)
    3759 * mpfr_digamma:                          Special Functions.   (line 166)
     3777* mpfr_digamma:                          Special Functions.   (line 172)
    37603778* mpfr_dim:                              Basic Arithmetic Functions.
    3761                                                               (line 166)
     3779                                                              (line 171)
    37623780* mpfr_div:                              Basic Arithmetic Functions.
    3763                                                               (line  72)
     3781                                                              (line  74)
    37643782* mpfr_divby0_p:                         Exception Related Functions.
    37653783                                                              (line 134)
    37663784* mpfr_div_2exp:                         Compatibility with MPF.
    37673785                                                              (line  49)
    37683786* mpfr_div_2si:                          Basic Arithmetic Functions.
    3769                                                               (line 181)
     3787                                                              (line 186)
    37703788* mpfr_div_2ui:                          Basic Arithmetic Functions.
    3771                                                               (line 179)
     3789                                                              (line 184)
    37723790* mpfr_div_d:                            Basic Arithmetic Functions.
    3773                                                               (line  84)
     3791                                                              (line  86)
    37743792* mpfr_div_q:                            Basic Arithmetic Functions.
    3775                                                               (line  88)
     3793                                                              (line  90)
    37763794* mpfr_div_si:                           Basic Arithmetic Functions.
    3777                                                               (line  80)
     3795                                                              (line  82)
    37783796* mpfr_div_ui:                           Basic Arithmetic Functions.
    3779                                                               (line  76)
     3797                                                              (line  78)
    37803798* mpfr_div_z:                            Basic Arithmetic Functions.
    3781                                                               (line  86)
     3799                                                              (line  88)
    37823800* mpfr_d_div:                            Basic Arithmetic Functions.
    3783                                                               (line  82)
     3801                                                              (line  84)
    37843802* mpfr_d_sub:                            Basic Arithmetic Functions.
    3785                                                               (line  35)
    3786 * mpfr_eint:                             Special Functions.   (line 133)
     3803                                                              (line  36)
     3804* mpfr_eint:                             Special Functions.   (line 135)
    37873805* mpfr_eq:                               Compatibility with MPF.
    37883806                                                              (line  28)
    37893807* mpfr_equal_p:                          Comparison Functions.
    37903808                                                              (line  59)
    37913809* mpfr_erangeflag_p:                     Exception Related Functions.
    37923810                                                              (line 137)
    3793 * mpfr_erf:                              Special Functions.   (line 177)
    3794 * mpfr_erfc:                             Special Functions.   (line 178)
    3795 * mpfr_exp:                              Special Functions.   (line  23)
    3796 * mpfr_exp10:                            Special Functions.   (line  25)
    3797 * mpfr_exp2:                             Special Functions.   (line  24)
    3798 * mpfr_expm1:                            Special Functions.   (line 129)
    3799 * mpfr_fac_ui:                           Special Functions.   (line 121)
     3811* mpfr_erf:                              Special Functions.   (line 183)
     3812* mpfr_erfc:                             Special Functions.   (line 184)
     3813* mpfr_exp:                              Special Functions.   (line  25)
     3814* mpfr_exp10:                            Special Functions.   (line  27)
     3815* mpfr_exp2:                             Special Functions.   (line  26)
     3816* mpfr_expm1:                            Special Functions.   (line 131)
     3817* mpfr_fac_ui:                           Special Functions.   (line 123)
    38003818* mpfr_fits_intmax_p:                    Conversion Functions.
    38013819                                                              (line 150)
    38023820* mpfr_fits_sint_p:                      Conversion Functions.
     
    38153833                                                              (line 147)
    38163834* mpfr_floor:                            Integer Related Functions.
    38173835                                                              (line   8)
    3818 * mpfr_fma:                              Special Functions.   (line 203)
     3836* mpfr_fma:                              Special Functions.   (line 209)
    38193837* mpfr_fmod:                             Integer Related Functions.
    38203838                                                              (line  92)
    3821 * mpfr_fms:                              Special Functions.   (line 205)
     3839* mpfr_fms:                              Special Functions.   (line 211)
    38223840* mpfr_fprintf:                          Formatted Output Functions.
    38233841                                                              (line 157)
    38243842* mpfr_frac:                             Integer Related Functions.
    38253843                                                              (line  76)
    3826 * mpfr_free_cache:                       Special Functions.   (line 244)
     3844* mpfr_free_cache:                       Special Functions.   (line 254)
    38273845* mpfr_free_str:                         Conversion Functions.
    38283846                                                              (line 137)
    38293847* mpfr_frexp:                            Conversion Functions.
    38303848                                                              (line  45)
    3831 * mpfr_gamma:                            Special Functions.   (line 148)
     3849* mpfr_gamma:                            Special Functions.   (line 150)
    38323850* mpfr_get_d:                            Conversion Functions.
    38333851                                                              (line   7)
    38343852* mpfr_get_decimal64:                    Conversion Functions.
     
    38873905                                                              (line  56)
    38883906* mpfr_greater_p:                        Comparison Functions.
    38893907                                                              (line  55)
    3890 * mpfr_hypot:                            Special Functions.   (line 218)
     3908* mpfr_hypot:                            Special Functions.   (line 227)
    38913909* mpfr_inexflag_p:                       Exception Related Functions.
    38923910                                                              (line 136)
    38933911* mpfr_inf_p:                            Comparison Functions.
     
    39223940                                                              (line  31)
    39233941* mpfr_integer_p:                        Integer Related Functions.
    39243942                                                              (line 119)
    3925 * mpfr_j0:                               Special Functions.   (line 182)
    3926 * mpfr_j1:                               Special Functions.   (line 183)
    3927 * mpfr_jn:                               Special Functions.   (line 184)
     3943* mpfr_j0:                               Special Functions.   (line 188)
     3944* mpfr_j1:                               Special Functions.   (line 189)
     3945* mpfr_jn:                               Special Functions.   (line 190)
    39283946* mpfr_lessequal_p:                      Comparison Functions.
    39293947                                                              (line  58)
    39303948* mpfr_lessgreater_p:                    Comparison Functions.
    39313949                                                              (line  64)
    39323950* mpfr_less_p:                           Comparison Functions.
    39333951                                                              (line  57)
    3934 * mpfr_lgamma:                           Special Functions.   (line 157)
    3935 * mpfr_li2:                              Special Functions.   (line 143)
    3936 * mpfr_lngamma:                          Special Functions.   (line 152)
     3952* mpfr_lgamma:                           Special Functions.   (line 162)
     3953* mpfr_li2:                              Special Functions.   (line 145)
     3954* mpfr_lngamma:                          Special Functions.   (line 154)
    39373955* mpfr_log:                              Special Functions.   (line  16)
    39383956* mpfr_log10:                            Special Functions.   (line  18)
    3939 * mpfr_log1p:                            Special Functions.   (line 125)
     3957* mpfr_log1p:                            Special Functions.   (line 127)
    39403958* mpfr_log2:                             Special Functions.   (line  17)
    39413959* mpfr_max:                              Miscellaneous Functions.
    39423960                                                              (line  22)
     
    39473965* mpfr_modf:                             Integer Related Functions.
    39483966                                                              (line  82)
    39493967* mpfr_mul:                              Basic Arithmetic Functions.
    3950                                                               (line  51)
     3968                                                              (line  53)
    39513969* mpfr_mul_2exp:                         Compatibility with MPF.
    39523970                                                              (line  47)
    39533971* mpfr_mul_2si:                          Basic Arithmetic Functions.
    3954                                                               (line 174)
     3972                                                              (line 179)
    39553973* mpfr_mul_2ui:                          Basic Arithmetic Functions.
    3956                                                               (line 172)
     3974                                                              (line 177)
    39573975* mpfr_mul_d:                            Basic Arithmetic Functions.
    3958                                                               (line  57)
     3976                                                              (line  59)
    39593977* mpfr_mul_q:                            Basic Arithmetic Functions.
    3960                                                               (line  61)
     3978                                                              (line  63)
    39613979* mpfr_mul_si:                           Basic Arithmetic Functions.
    3962                                                               (line  55)
     3980                                                              (line  57)
    39633981* mpfr_mul_ui:                           Basic Arithmetic Functions.
    3964                                                               (line  53)
     3982                                                              (line  55)
    39653983* mpfr_mul_z:                            Basic Arithmetic Functions.
    3966                                                               (line  59)
     3984                                                              (line  61)
    39673985* mpfr_nanflag_p:                        Exception Related Functions.
    39683986                                                              (line 135)
    39693987* mpfr_nan_p:                            Comparison Functions.
    39703988                                                              (line  39)
    39713989* mpfr_neg:                              Basic Arithmetic Functions.
    3972                                                               (line 159)
     3990                                                              (line 164)
    39733991* mpfr_nextabove:                        Miscellaneous Functions.
    39743992                                                              (line  15)
    39753993* mpfr_nextbelow:                        Miscellaneous Functions.
     
    39834001* mpfr_overflow_p:                       Exception Related Functions.
    39844002                                                              (line 133)
    39854003* mpfr_pow:                              Basic Arithmetic Functions.
    3986                                                               (line 116)
     4004                                                              (line 121)
    39874005* mpfr_pow_si:                           Basic Arithmetic Functions.
    3988                                                               (line 120)
     4006                                                              (line 125)
    39894007* mpfr_pow_ui:                           Basic Arithmetic Functions.
    3990                                                               (line 118)
     4008                                                              (line 123)
    39914009* mpfr_pow_z:                            Basic Arithmetic Functions.
    3992                                                               (line 122)
     4010                                                              (line 127)
    39934011* mpfr_prec_round:                       Rounding Related Functions.
    39944012                                                              (line  13)
    39954013* ‘mpfr_prec_t’:                         Nomenclature and Types.
     
    39994017* mpfr_print_rnd_mode:                   Rounding Related Functions.
    40004018                                                              (line  71)
    40014019* mpfr_rec_sqrt:                         Basic Arithmetic Functions.
    4002                                                               (line 103)
     4020                                                              (line 105)
    40034021* mpfr_regular_p:                        Comparison Functions.
    40044022                                                              (line  43)
    40054023* mpfr_reldiff:                          Compatibility with MPF.
     
    40214039* ‘mpfr_rnd_t’:                          Nomenclature and Types.
    40224040                                                              (line  34)
    40234041* mpfr_root:                             Basic Arithmetic Functions.
    4024                                                               (line 109)
     4042                                                              (line 114)
    40254043* mpfr_round:                            Integer Related Functions.
    40264044                                                              (line   9)
    4027 * mpfr_sec:                              Special Functions.   (line  45)
    4028 * mpfr_sech:                             Special Functions.   (line 109)
     4045* mpfr_sec:                              Special Functions.   (line  47)
     4046* mpfr_sech:                             Special Functions.   (line 111)
    40294047* mpfr_set:                              Assignment Functions.
    40304048                                                              (line   9)
    40314049* mpfr_setsign:                          Miscellaneous Functions.
     
    41004118                                                              (line  49)
    41014119* mpfr_signbit:                          Miscellaneous Functions.
    41024120                                                              (line  99)
    4103 * mpfr_sin:                              Special Functions.   (line  30)
    4104 * mpfr_sinh:                             Special Functions.   (line  96)
    4105 * mpfr_sinh_cosh:                        Special Functions.   (line 101)
    4106 * mpfr_sin_cos:                          Special Functions.   (line  35)
     4121* mpfr_sin:                              Special Functions.   (line  32)
     4122* mpfr_sinh:                             Special Functions.   (line  98)
     4123* mpfr_sinh_cosh:                        Special Functions.   (line 103)
     4124* mpfr_sin_cos:                          Special Functions.   (line  37)
    41074125* mpfr_si_div:                           Basic Arithmetic Functions.
    4108                                                               (line  78)
     4126                                                              (line  80)
    41094127* mpfr_si_sub:                           Basic Arithmetic Functions.
    4110                                                               (line  31)
     4128                                                              (line  32)
    41114129* mpfr_snprintf:                         Formatted Output Functions.
    41124130                                                              (line 180)
    41134131* mpfr_sprintf:                          Formatted Output Functions.
    41144132                                                              (line 170)
    41154133* mpfr_sqr:                              Basic Arithmetic Functions.
    4116                                                               (line  69)
     4134                                                              (line  71)
    41174135* mpfr_sqrt:                             Basic Arithmetic Functions.
    4118                                                               (line  96)
     4136                                                              (line  98)
    41194137* mpfr_sqrt_ui:                          Basic Arithmetic Functions.
    4120                                                               (line  97)
     4138                                                              (line  99)
    41214139* mpfr_strtofr:                          Assignment Functions.
    41224140                                                              (line  80)
    41234141* mpfr_sub:                              Basic Arithmetic Functions.
    4124                                                               (line  25)
     4142                                                              (line  26)
    41254143* mpfr_subnormalize:                     Exception Related Functions.
    41264144                                                              (line  60)
    41274145* mpfr_sub_d:                            Basic Arithmetic Functions.
    4128                                                               (line  37)
     4146                                                              (line  38)
    41294147* mpfr_sub_q:                            Basic Arithmetic Functions.
    4130                                                               (line  43)
     4148                                                              (line  44)
    41314149* mpfr_sub_si:                           Basic Arithmetic Functions.
    4132                                                               (line  33)
     4150                                                              (line  34)
    41334151* mpfr_sub_ui:                           Basic Arithmetic Functions.
    4134                                                               (line  29)
     4152                                                              (line  30)
    41354153* mpfr_sub_z:                            Basic Arithmetic Functions.
    4136                                                               (line  41)
    4137 * mpfr_sum:                              Special Functions.   (line 252)
     4154                                                              (line  42)
     4155* mpfr_sum:                              Special Functions.   (line 262)
    41384156* mpfr_swap:                             Assignment Functions.
    41394157                                                              (line 150)
    41404158* ‘mpfr_t’:                              Nomenclature and Types.
    41414159                                                              (line   6)
    4142 * mpfr_tan:                              Special Functions.   (line  31)
    4143 * mpfr_tanh:                             Special Functions.   (line  97)
     4160* mpfr_tan:                              Special Functions.   (line  33)
     4161* mpfr_tanh:                             Special Functions.   (line  99)
    41444162* mpfr_trunc:                            Integer Related Functions.
    41454163                                                              (line  10)
    41464164* mpfr_ui_div:                           Basic Arithmetic Functions.
    4147                                                               (line  74)
     4165                                                              (line  76)
    41484166* mpfr_ui_pow:                           Basic Arithmetic Functions.
    4149                                                               (line 126)
     4167                                                              (line 131)
    41504168* mpfr_ui_pow_ui:                        Basic Arithmetic Functions.
    4151                                                               (line 124)
     4169                                                              (line 129)
    41524170* mpfr_ui_sub:                           Basic Arithmetic Functions.
    4153                                                               (line  27)
     4171                                                              (line  28)
    41544172* mpfr_underflow_p:                      Exception Related Functions.
    41554173                                                              (line 132)
    41564174* mpfr_unordered_p:                      Comparison Functions.
     
    41814199                                                              (line 182)
    41824200* mpfr_vsprintf:                         Formatted Output Functions.
    41834201                                                              (line 171)
    4184 * mpfr_y0:                               Special Functions.   (line 193)
    4185 * mpfr_y1:                               Special Functions.   (line 194)
    4186 * mpfr_yn:                               Special Functions.   (line 195)
     4202* mpfr_y0:                               Special Functions.   (line 199)
     4203* mpfr_y1:                               Special Functions.   (line 200)
     4204* mpfr_yn:                               Special Functions.   (line 201)
    41874205* mpfr_zero_p:                           Comparison Functions.
    41884206                                                              (line  42)
    4189 * mpfr_zeta:                             Special Functions.   (line 171)
    4190 * mpfr_zeta_ui:                          Special Functions.   (line 172)
     4207* mpfr_zeta:                             Special Functions.   (line 177)
     4208* mpfr_zeta_ui:                          Special Functions.   (line 178)
    41914209* mpfr_z_sub:                            Basic Arithmetic Functions.
    4192                                                               (line  39)
     4210                                                              (line  40)
    41934211
    41944212
    41954213
    41964214Tag Table:
    41974215Node: Top775
    41984216Node: Copying2007
    4199 Node: Introduction to MPFR3766
    4200 Node: Installing MPFR5880
    4201 Node: Reporting Bugs11323
    4202 Node: MPFR Basics13353
    4203 Node: Headers and Libraries13669
    4204 Node: Nomenclature and Types16828
    4205 Node: MPFR Variable Conventions18874
    4206 Node: Rounding Modes20418
    4207 Ref: ternary value21544
    4208 Node: Floating-Point Values on Special Numbers23526
    4209 Node: Exceptions26572
    4210 Node: Memory Handling29749
    4211 Node: MPFR Interface30894
    4212 Node: Initialization Functions33008
    4213 Node: Assignment Functions40318
    4214 Node: Combined Initialization and Assignment Functions49673
    4215 Node: Conversion Functions50974
    4216 Node: Basic Arithmetic Functions60035
    4217 Node: Comparison Functions69200
    4218 Node: Special Functions72687
    4219 Node: Input and Output Functions86672
    4220 Node: Formatted Output Functions88644
    4221 Node: Integer Related Functions98431
    4222 Node: Rounding Related Functions105051
    4223 Node: Miscellaneous Functions108888
    4224 Node: Exception Related Functions117568
    4225 Node: Compatibility with MPF124386
    4226 Node: Custom Interface127127
    4227 Node: Internals131526
    4228 Node: API Compatibility133066
    4229 Node: Type and Macro Changes134995
    4230 Node: Added Functions137844
    4231 Node: Changed Functions141132
    4232 Node: Removed Functions145545
    4233 Node: Other Changes145973
    4234 Node: Contributors147576
    4235 Node: References150219
    4236 Node: GNU Free Documentation License151973
    4237 Node: Concept Index174562
    4238 Node: Function and Type Index180659
     4217Node: Introduction to MPFR3770
     4218Node: Installing MPFR5884
     4219Node: Reporting Bugs11327
     4220Node: MPFR Basics13357
     4221Node: Headers and Libraries13673
     4222Node: Nomenclature and Types16832
     4223Node: MPFR Variable Conventions18894
     4224Node: Rounding Modes20438
     4225Ref: ternary value21568
     4226Node: Floating-Point Values on Special Numbers23554
     4227Node: Exceptions26813
     4228Node: Memory Handling29990
     4229Node: MPFR Interface31135
     4230Node: Initialization Functions33249
     4231Node: Assignment Functions40559
     4232Node: Combined Initialization and Assignment Functions49914
     4233Node: Conversion Functions51215
     4234Node: Basic Arithmetic Functions60276
     4235Node: Comparison Functions69777
     4236Node: Special Functions73264
     4237Node: Input and Output Functions87862
     4238Node: Formatted Output Functions89834
     4239Node: Integer Related Functions99621
     4240Node: Rounding Related Functions106241
     4241Node: Miscellaneous Functions110078
     4242Node: Exception Related Functions118758
     4243Node: Compatibility with MPF125576
     4244Node: Custom Interface128317
     4245Node: Internals132716
     4246Node: API Compatibility134260
     4247Node: Type and Macro Changes136189
     4248Node: Added Functions139038
     4249Node: Changed Functions142326
     4250Node: Removed Functions146739
     4251Node: Other Changes147167
     4252Node: Contributors148770
     4253Node: References151413
     4254Node: GNU Free Documentation License153167
     4255Node: Concept Index175760
     4256Node: Function and Type Index181857
    42394257
    42404258End Tag Table
    42414259
  • src/lngamma.c

    diff -Naurd mpfr-3.1.3-a/src/lngamma.c mpfr-3.1.3-b/src/lngamma.c
    old new  
    603603      mpfr_get_prec (y), mpfr_log_prec, y, inex));
    604604
    605605  /* special cases */
    606   if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
     606  if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x) ||
     607                     (MPFR_IS_NEG (x) && mpfr_integer_p (x))))
    607608    {
    608       if (MPFR_IS_NAN (x) || MPFR_IS_NEG (x))
     609      if (MPFR_IS_NAN (x))
    609610        {
    610611          MPFR_SET_NAN (y);
    611612          MPFR_RET_NAN;
    612613        }
    613       else /* lngamma(+Inf) = lngamma(+0) = +Inf */
     614      else /* lngamma(+/-Inf) = lngamma(nonpositive integer) = +Inf */
    614615        {
    615           if (MPFR_IS_ZERO (x))
     616          if (!MPFR_IS_INF (x))
    616617            mpfr_set_divby0 ();
    617618          MPFR_SET_INF (y);
    618619          MPFR_SET_POS (y);
     
    620621        }
    621622    }
    622623
    623   /* if x < 0 and -2k-1 <= x <= -2k, then lngamma(x) = NaN */
    624   if (MPFR_IS_NEG (x) && (unit_bit (x) == 0 || mpfr_integer_p (x)))
     624  /* if -2k-1 < x < -2k <= 0, then lngamma(x) = NaN */
     625  if (MPFR_IS_NEG (x) && unit_bit (x) == 0)
    625626    {
    626627      MPFR_SET_NAN (y);
    627628      MPFR_RET_NAN;
  • src/mpfr.h

    diff -Naurd mpfr-3.1.3-a/src/mpfr.h mpfr-3.1.3-b/src/mpfr.h
    old new  
    2727#define MPFR_VERSION_MAJOR 3
    2828#define MPFR_VERSION_MINOR 1
    2929#define MPFR_VERSION_PATCHLEVEL 3
    30 #define MPFR_VERSION_STRING "3.1.3"
     30#define MPFR_VERSION_STRING "3.1.3-p1"
    3131
    3232/* Macros dealing with MPFR VERSION */
    3333#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
  • src/version.c

    diff -Naurd mpfr-3.1.3-a/src/version.c mpfr-3.1.3-b/src/version.c
    old new  
    2525const char *
    2626mpfr_get_version (void)
    2727{
    28   return "3.1.3";
     28  return "3.1.3-p1";
    2929}
  • tests/tlngamma.c

    diff -Naurd mpfr-3.1.3-a/tests/tlngamma.c mpfr-3.1.3-b/tests/tlngamma.c
    old new  
    3333special (void)
    3434{
    3535  mpfr_t x, y;
    36   int inex;
     36  int i, inex;
    3737
    3838  mpfr_init (x);
    3939  mpfr_init (y);
     
    4646      exit (1);
    4747    }
    4848
    49   mpfr_set_inf (x, -1);
     49  mpfr_set_inf (x, 1);
     50  mpfr_clear_flags ();
    5051  mpfr_lngamma (y, x, MPFR_RNDN);
    51   if (!mpfr_nan_p (y))
     52  if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 || __gmpfr_flags != 0)
    5253    {
    53       printf ("Error for lngamma(-Inf)\n");
     54      printf ("Error for lngamma(+Inf)\n");
    5455      exit (1);
    5556    }
    5657
    57   mpfr_set_inf (x, 1);
     58  mpfr_set_inf (x, -1);
     59  mpfr_clear_flags ();
    5860  mpfr_lngamma (y, x, MPFR_RNDN);
    59   if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
     61  if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 || __gmpfr_flags != 0)
    6062    {
    61       printf ("Error for lngamma(+Inf)\n");
     63      printf ("Error for lngamma(-Inf)\n");
    6264      exit (1);
    6365    }
    6466
    6567  mpfr_set_ui (x, 0, MPFR_RNDN);
     68  mpfr_clear_flags ();
    6669  mpfr_lngamma (y, x, MPFR_RNDN);
    67   if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0)
     70  if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 ||
     71      __gmpfr_flags != MPFR_FLAGS_DIVBY0)
    6872    {
    6973      printf ("Error for lngamma(+0)\n");
    7074      exit (1);
     
    7276
    7377  mpfr_set_ui (x, 0, MPFR_RNDN);
    7478  mpfr_neg (x, x, MPFR_RNDN);
     79  mpfr_clear_flags ();
    7580  mpfr_lngamma (y, x, MPFR_RNDN);
    76   if (!mpfr_nan_p (y))
     81  if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 ||
     82      __gmpfr_flags != MPFR_FLAGS_DIVBY0)
    7783    {
    7884      printf ("Error for lngamma(-0)\n");
    7985      exit (1);
    8086    }
    8187
    8288  mpfr_set_ui (x, 1, MPFR_RNDN);
     89  mpfr_clear_flags ();
    8390  mpfr_lngamma (y, x, MPFR_RNDN);
    84   if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y))
     91  if (mpfr_cmp_ui0 (y, 0) || MPFR_IS_NEG (y))
    8592    {
    8693      printf ("Error for lngamma(1)\n");
    8794      exit (1);
    8895    }
    8996
    90   mpfr_set_si (x, -1, MPFR_RNDN);
    91   mpfr_lngamma (y, x, MPFR_RNDN);
    92   if (!mpfr_nan_p (y))
     97  for (i = 1; i <= 5; i++)
    9398    {
    94       printf ("Error for lngamma(-1)\n");
    95       exit (1);
     99      int c;
     100
     101      mpfr_set_si (x, -i, MPFR_RNDN);
     102      mpfr_clear_flags ();
     103      mpfr_lngamma (y, x, MPFR_RNDN);
     104      if (!mpfr_inf_p (y) || mpfr_sgn (y) < 0 ||
     105          __gmpfr_flags != MPFR_FLAGS_DIVBY0)
     106        {
     107          printf ("Error for lngamma(-%d)\n", i);
     108          exit (1);
     109        }
     110      if (i & 1)
     111        {
     112          mpfr_nextabove (x);
     113          c = '+';
     114        }
     115      else
     116        {
     117          mpfr_nextbelow (x);
     118          c = '-';
     119        }
     120      mpfr_lngamma (y, x, MPFR_RNDN);
     121      if (!mpfr_nan_p (y))
     122        {
     123          printf ("Error for lngamma(-%d%cepsilon)\n", i, c);
     124          exit (1);
     125        }
    96126    }
    97127
    98128  mpfr_set_ui (x, 2, MPFR_RNDN);
    99129  mpfr_lngamma (y, x, MPFR_RNDN);
    100   if (MPFR_IS_NAN (y) || mpfr_cmp_ui (y, 0) || MPFR_IS_NEG (y))
     130  if (mpfr_cmp_ui0 (y, 0) || MPFR_IS_NEG (y))
    101131    {
    102132      printf ("Error for lngamma(2)\n");
    103133      exit (1);
     
    127157  mpfr_set_str (x, CHECK_X2, 10, MPFR_RNDN);
    128158  mpfr_lngamma (y, x, MPFR_RNDN);
    129159  mpfr_set_str (x, CHECK_Y2, 10, MPFR_RNDN);
    130   if (MPFR_IS_NAN (y) || mpfr_cmp (y, x))
     160  if (mpfr_cmp0 (y, x))
    131161    {
    132162      printf ("mpfr_lngamma("CHECK_X2") is wrong:\n"
    133163              "expected ");
     
    143173  mpfr_lngamma (y, x, MPFR_RNDU);
    144174  mpfr_set_prec (x, 175);
    145175  mpfr_set_str_binary (x, "0.1010001100011101101011001101110010100001000001000001110011000001101100001111001001000101011011100100010101011110100111110101010100010011010010000101010111001100011000101111E7");
    146   if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
     176  if (mpfr_cmp0 (x, y))
    147177    {
    148178      printf ("Error in mpfr_lngamma (1)\n");
    149179      exit (1);
     
    155185  mpfr_lngamma (x, y, MPFR_RNDZ);
    156186  mpfr_set_prec (y, 21);
    157187  mpfr_set_str_binary (y, "0.111000101000001100101E9");
    158   if (MPFR_IS_NAN (x) || mpfr_cmp (x, y))
     188  if (mpfr_cmp0 (x, y))
    159189    {
    160190      printf ("Error in mpfr_lngamma (120)\n");
    161191      printf ("Expected "); mpfr_print_binary (y); puts ("");
     
    169199  inex = mpfr_lngamma (y, x, MPFR_RNDN);
    170200  mpfr_set_prec (x, 206);
    171201  mpfr_set_str_binary (x, "0.10000111011000000011100010101001100110001110000111100011000100100110110010001011011110101001111011110110000001010100111011010000000011100110110101100111000111010011110010000100010111101010001101000110101001E13");
    172   if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
     202  if (mpfr_cmp0 (x, y))
    173203    {
    174204      printf ("Error in mpfr_lngamma (768)\n");
    175205      exit (1);
     
    185215  mpfr_set_str_binary (x, "0.1100E-66");
    186216  mpfr_lngamma (y, x, MPFR_RNDN);
    187217  mpfr_set_str_binary (x, "0.1100E6");
    188   if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
     218  if (mpfr_cmp0 (x, y))
    189219    {
    190220      printf ("Error for lngamma(0.1100E-66)\n");
    191221      exit (1);
     
    199229  mpfr_lngamma (y, x, MPFR_RNDN);
    200230  mpfr_set_prec (x, 32);
    201231  mpfr_set_str_binary (x, "-0.10001000111011111011000010100010E207");
    202   if (MPFR_IS_NAN (y) || mpfr_cmp (x, y))
     232  if (mpfr_cmp0 (x, y))
    203233    {
    204234      printf ("Error for lngamma(-2^199+0.5)\n");
    205235      printf ("Got        ");
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.3-a/PATCHES mpfr-3.1.3-b/PATCHES
    old new  
     1muldiv-2exp-overflow
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.3-a/VERSION mpfr-3.1.3-b/VERSION
    old new  
    1 3.1.3-p1
     13.1.3-p2
  • src/div_2si.c

    diff -Naurd mpfr-3.1.3-a/src/div_2si.c mpfr-3.1.3-b/src/div_2si.c
    old new  
    4949            rnd_mode = MPFR_RNDZ;
    5050          return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y));
    5151        }
    52       else if (MPFR_UNLIKELY(n < 0 && (__gmpfr_emax < MPFR_EMIN_MIN - n ||
     52      else if (MPFR_UNLIKELY(n <= 0 && (__gmpfr_emax < MPFR_EMIN_MIN - n ||
    5353                                       exp > __gmpfr_emax + n)) )
    5454        return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y));
    5555
  • src/div_2ui.c

    diff -Naurd mpfr-3.1.3-a/src/div_2ui.c mpfr-3.1.3-b/src/div_2ui.c
    old new  
    3232     rnd_mode),
    3333    ("y[%Pu]=%.*Rg inexact=%d", mpfr_get_prec(y), mpfr_log_prec, y, inexact));
    3434
    35   if (MPFR_UNLIKELY (MPFR_IS_SINGULAR (x)))
     35  if (MPFR_UNLIKELY (n == 0 || MPFR_IS_SINGULAR (x)))
    3636    return mpfr_set (y, x, rnd_mode);
    3737  else
    3838    {
  • src/mpfr.h

    diff -Naurd mpfr-3.1.3-a/src/mpfr.h mpfr-3.1.3-b/src/mpfr.h
    old new  
    2727#define MPFR_VERSION_MAJOR 3
    2828#define MPFR_VERSION_MINOR 1
    2929#define MPFR_VERSION_PATCHLEVEL 3
    30 #define MPFR_VERSION_STRING "3.1.3-p1"
     30#define MPFR_VERSION_STRING "3.1.3-p2"
    3131
    3232/* Macros dealing with MPFR VERSION */
    3333#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
  • src/mul_2si.c

    diff -Naurd mpfr-3.1.3-a/src/mul_2si.c mpfr-3.1.3-b/src/mul_2si.c
    old new  
    3939    {
    4040      mpfr_exp_t exp = MPFR_GET_EXP (x);
    4141      MPFR_SETRAW (inexact, y, x, exp, rnd_mode);
    42       if (MPFR_UNLIKELY( n > 0 && (__gmpfr_emax < MPFR_EMIN_MIN + n ||
     42      if (MPFR_UNLIKELY(n >= 0 && (__gmpfr_emax < MPFR_EMIN_MIN + n ||
    4343                                   exp > __gmpfr_emax - n)))
    4444        return mpfr_overflow (y, rnd_mode, MPFR_SIGN(y));
    4545      else if (MPFR_UNLIKELY(n < 0 && (__gmpfr_emin > MPFR_EMAX_MAX + n ||
  • src/version.c

    diff -Naurd mpfr-3.1.3-a/src/version.c mpfr-3.1.3-b/src/version.c
    old new  
    2525const char *
    2626mpfr_get_version (void)
    2727{
    28   return "3.1.3-p1";
     28  return "3.1.3-p2";
    2929}
  • tests/tmul_2exp.c

    diff -Naurd mpfr-3.1.3-a/tests/tmul_2exp.c mpfr-3.1.3-b/tests/tmul_2exp.c
    old new  
    242242  large (MPFR_EMAX_MAX);
    243243}
    244244
     245/* Cases where the function overflows on n = 0 when rounding is like
     246   away from zero. */
     247static void
     248overflow0 (mpfr_exp_t emax)
     249{
     250  mpfr_exp_t old_emax;
     251  mpfr_t x, y1, y2;
     252  int neg, r, op;
     253  static char *sop[4] = { "mul_2ui", "mul_2si", "div_2ui", "div_2si" };
     254
     255  old_emax = mpfr_get_emax ();
     256  set_emax (emax);
     257
     258  mpfr_init2 (x, 8);
     259  mpfr_inits2 (6, y1, y2, (mpfr_ptr) 0);
     260
     261  mpfr_set_inf (x, 1);
     262  mpfr_nextbelow (x);
     263
     264  for (neg = 0; neg <= 1; neg++)
     265    {
     266      RND_LOOP (r)
     267        {
     268          int inex1, inex2;
     269          unsigned int flags1, flags2;
     270
     271          /* Even if there isn't an overflow (rounding ~ toward zero),
     272             the result is the same as the one of an overflow. */
     273          inex1 = mpfr_overflow (y1, (mpfr_rnd_t) r, neg ? -1 : 1);
     274          flags1 = MPFR_FLAGS_INEXACT;
     275          if (mpfr_inf_p (y1))
     276            flags1 |= MPFR_FLAGS_OVERFLOW;
     277          for (op = 0; op < 4; op++)
     278            {
     279              mpfr_clear_flags ();
     280              inex2 =
     281                op == 0 ? mpfr_mul_2ui (y2, x, 0, (mpfr_rnd_t) r) :
     282                op == 1 ? mpfr_mul_2si (y2, x, 0, (mpfr_rnd_t) r) :
     283                op == 2 ? mpfr_div_2ui (y2, x, 0, (mpfr_rnd_t) r) :
     284                op == 3 ? mpfr_div_2si (y2, x, 0, (mpfr_rnd_t) r) :
     285                (MPFR_ASSERTN (0), 0);
     286              flags2 = __gmpfr_flags;
     287              if (!(mpfr_equal_p (y1, y2) &&
     288                    SAME_SIGN (inex1, inex2) &&
     289                    flags1 == flags2))
     290                {
     291                  printf ("Error in overflow0 for %s, mpfr_%s, emax = %"
     292                          MPFR_EXP_FSPEC "d,\nx = ",
     293                          mpfr_print_rnd_mode ((mpfr_rnd_t) r), sop[op],
     294                          (mpfr_eexp_t) emax);
     295                  mpfr_dump (x);
     296                  printf ("Expected ");
     297                  mpfr_dump (y1);
     298                  printf ("  with inex = %d, flags =", inex1);
     299                  flags_out (flags1);
     300                  printf ("Got      ");
     301                  mpfr_dump (y2);
     302                  printf ("  with inex = %d, flags =", inex2);
     303                  flags_out (flags2);
     304                  exit (1);
     305                }
     306            }
     307        }
     308      mpfr_neg (x, x, MPFR_RNDN);
     309    }
     310
     311  mpfr_clears (x, y1, y2, (mpfr_ptr) 0);
     312  set_emax (old_emax);
     313}
     314
    245315int
    246316main (int argc, char *argv[])
    247317{
     
    334404  underflow0 ();
    335405  large0 ();
    336406
     407  if (mpfr_get_emax () != MPFR_EMAX_MAX)
     408    overflow0 (mpfr_get_emax ());
     409  overflow0 (MPFR_EMAX_MAX);
     410  overflow0 (-1);
     411
    337412  tests_end_mpfr ();
    338413  return 0;
    339414}
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.3-a/PATCHES mpfr-3.1.3-b/PATCHES
    old new  
     1muldiv-2exp-underflow
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.3-a/VERSION mpfr-3.1.3-b/VERSION
    old new  
    1 3.1.3-p2
     13.1.3-p3
  • src/div_2si.c

    diff -Naurd mpfr-3.1.3-a/src/div_2si.c mpfr-3.1.3-b/src/div_2si.c
    old new  
    4545          if (rnd_mode == MPFR_RNDN &&
    4646              (__gmpfr_emin > MPFR_EMAX_MAX - (n - 1) ||
    4747               exp < __gmpfr_emin + (n - 1) ||
    48                (inexact >= 0 && mpfr_powerof2_raw (y))))
     48               ((MPFR_IS_NEG (y) ? inexact <= 0 : inexact >= 0) &&
     49                mpfr_powerof2_raw (y))))
    4950            rnd_mode = MPFR_RNDZ;
    5051          return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y));
    5152        }
  • src/div_2ui.c

    diff -Naurd mpfr-3.1.3-a/src/div_2ui.c mpfr-3.1.3-b/src/div_2ui.c
    old new  
    4444      if (MPFR_UNLIKELY (n >= diffexp))  /* exp - n <= emin - 1 */
    4545        {
    4646          if (rnd_mode == MPFR_RNDN &&
    47               (n > diffexp || (inexact >= 0 && mpfr_powerof2_raw (y))))
     47              (n > diffexp ||
     48               ((MPFR_IS_NEG (y) ? inexact <= 0 : inexact >= 0) &&
     49                mpfr_powerof2_raw (y))))
    4850            rnd_mode = MPFR_RNDZ;
    4951          return mpfr_underflow (y, rnd_mode, MPFR_SIGN (y));
    5052        }
  • src/mpfr.h

    diff -Naurd mpfr-3.1.3-a/src/mpfr.h mpfr-3.1.3-b/src/mpfr.h
    old new  
    2727#define MPFR_VERSION_MAJOR 3
    2828#define MPFR_VERSION_MINOR 1
    2929#define MPFR_VERSION_PATCHLEVEL 3
    30 #define MPFR_VERSION_STRING "3.1.3-p2"
     30#define MPFR_VERSION_STRING "3.1.3-p3"
    3131
    3232/* Macros dealing with MPFR VERSION */
    3333#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
  • src/mul_2si.c

    diff -Naurd mpfr-3.1.3-a/src/mul_2si.c mpfr-3.1.3-b/src/mul_2si.c
    old new  
    4848          if (rnd_mode == MPFR_RNDN &&
    4949              (__gmpfr_emin > MPFR_EMAX_MAX + (n + 1) ||
    5050               exp < __gmpfr_emin - (n + 1) ||
    51                (inexact >= 0 && mpfr_powerof2_raw (y))))
     51               ((MPFR_IS_NEG (y) ? inexact <= 0 : inexact >= 0) &&
     52                mpfr_powerof2_raw (y))))
    5253            rnd_mode = MPFR_RNDZ;
    5354          return mpfr_underflow (y, rnd_mode, MPFR_SIGN(y));
    5455        }
  • src/version.c

    diff -Naurd mpfr-3.1.3-a/src/version.c mpfr-3.1.3-b/src/version.c
    old new  
    2525const char *
    2626mpfr_get_version (void)
    2727{
    28   return "3.1.3-p2";
     28  return "3.1.3-p3";
    2929}
  • tests/tmul_2exp.c

    diff -Naurd mpfr-3.1.3-a/tests/tmul_2exp.c mpfr-3.1.3-b/tests/tmul_2exp.c
    old new  
    5050{
    5151  mpfr_t x, y, z1, z2;
    5252  mpfr_exp_t emin;
    53   int i, k;
     53  int i, k, s;
    5454  int prec;
    5555  int rnd;
    5656  int div;
    5757  int inex1, inex2;
    5858  unsigned int flags1, flags2;
    5959
    60   /* Test mul_2si(x, e - k), div_2si(x, k - e) and div_2ui(x, k - e)
    61    * with emin = e, x = 1 + i/16, i in { -1, 0, 1 }, and k = 1 to 4,
    62    * by comparing the result with the one of a simple division.
     60  /* Test mul_2si(x, e - k), div_2si(x, k - e) and div_2ui(x, k - e) with
     61   * emin = e, x = s * (1 + i/16), i in { -1, 0, 1 }, s in { -1, 1 }, and
     62   * k = 1 to 4, by comparing the result with the one of a simple division.
    6363   */
    6464  emin = mpfr_get_emin ();
    6565  set_emin (e);
    6666  mpfr_inits2 (8, x, y, (mpfr_ptr) 0);
    6767  for (i = 15; i <= 17; i++)
    68     {
    69       inex1 = mpfr_set_ui_2exp (x, i, -4, MPFR_RNDN);
    70       MPFR_ASSERTN (inex1 == 0);
    71       for (prec = 6; prec >= 3; prec -= 3)
    72         {
    73           mpfr_inits2 (prec, z1, z2, (mpfr_ptr) 0);
    74           RND_LOOP (rnd)
    75             for (k = 1; k <= 4; k++)
    76               {
    77                 /* The following one is assumed to be correct. */
    78                 inex1 = mpfr_mul_2si (y, x, e, MPFR_RNDN);
    79                 MPFR_ASSERTN (inex1 == 0);
    80                 inex1 = mpfr_set_ui (z1, 1 << k, MPFR_RNDN);
    81                 MPFR_ASSERTN (inex1 == 0);
    82                 mpfr_clear_flags ();
    83                 /* Do not use mpfr_div_ui to avoid the optimization
    84                    by mpfr_div_2si. */
    85                 inex1 = mpfr_div (z1, y, z1, (mpfr_rnd_t) rnd);
    86                 flags1 = __gmpfr_flags;
    87 
    88               for (div = 0; div <= 2; div++)
     68    for (s = 1; s >= -1; s -= 2)
     69      {
     70        inex1 = mpfr_set_si_2exp (x, s * i, -4, MPFR_RNDN);
     71        MPFR_ASSERTN (inex1 == 0);
     72        for (prec = 6; prec >= 3; prec -= 3)
     73          {
     74            mpfr_inits2 (prec, z1, z2, (mpfr_ptr) 0);
     75            RND_LOOP (rnd)
     76              for (k = 1; k <= 4; k++)
    8977                {
     78                  /* The following one is assumed to be correct. */
     79                  inex1 = mpfr_mul_2si (y, x, e, MPFR_RNDN);
     80                  MPFR_ASSERTN (inex1 == 0);
     81                  inex1 = mpfr_set_ui (z1, 1 << k, MPFR_RNDN);
     82                  MPFR_ASSERTN (inex1 == 0);
    9083                  mpfr_clear_flags ();
    91                   inex2 = div == 0 ?
    92                     mpfr_mul_2si (z2, x, e - k, (mpfr_rnd_t) rnd) : div == 1 ?
    93                     mpfr_div_2si (z2, x, k - e, (mpfr_rnd_t) rnd) :
    94                     mpfr_div_2ui (z2, x, k - e, (mpfr_rnd_t) rnd);
    95                   flags2 = __gmpfr_flags;
    96                   if (flags1 == flags2 && SAME_SIGN (inex1, inex2) &&
    97                       mpfr_equal_p (z1, z2))
    98                     continue;
    99                   printf ("Error in underflow(");
    100                   if (e == MPFR_EMIN_MIN)
    101                     printf ("MPFR_EMIN_MIN");
    102                   else if (e == emin)
    103                     printf ("default emin");
    104                   else if (e >= LONG_MIN)
    105                     printf ("%ld", (long) e);
    106                   else
    107                     printf ("<LONG_MIN");
    108                   printf (") with mpfr_%s,\nx = %d/16, prec = %d, k = %d, "
    109                           "%s\n", div == 0 ? "mul_2si" : div == 1 ?
    110                           "div_2si" : "div_2ui", i, prec, k,
    111                           mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
    112                   printf ("Expected ");
    113                   mpfr_out_str (stdout, 16, 0, z1, MPFR_RNDN);
    114                   printf (", inex = %d, flags = %u\n", SIGN (inex1), flags1);
    115                   printf ("Got      ");
    116                   mpfr_out_str (stdout, 16, 0, z2, MPFR_RNDN);
    117                   printf (", inex = %d, flags = %u\n", SIGN (inex2), flags2);
    118                   exit (1);
    119                 }  /* div */
    120               }  /* k */
    121           mpfr_clears (z1, z2, (mpfr_ptr) 0);
    122         }  /* prec */
    123     }  /* i */
     84                  /* Do not use mpfr_div_ui to avoid the optimization
     85                     by mpfr_div_2si. */
     86                  inex1 = mpfr_div (z1, y, z1, (mpfr_rnd_t) rnd);
     87                  flags1 = __gmpfr_flags;
     88
     89                  for (div = 0; div <= 2; div++)
     90                    {
     91                      mpfr_clear_flags ();
     92                      inex2 =
     93                        div == 0 ?
     94                        mpfr_mul_2si (z2, x, e - k, (mpfr_rnd_t) rnd) :
     95                        div == 1 ?
     96                        mpfr_div_2si (z2, x, k - e, (mpfr_rnd_t) rnd) :
     97                        mpfr_div_2ui (z2, x, k - e, (mpfr_rnd_t) rnd);
     98                      flags2 = __gmpfr_flags;
     99                      if (flags1 == flags2 && SAME_SIGN (inex1, inex2) &&
     100                          mpfr_equal_p (z1, z2))
     101                        continue;
     102                      printf ("Error in underflow(");
     103                      if (e == MPFR_EMIN_MIN)
     104                        printf ("MPFR_EMIN_MIN");
     105                      else if (e == emin)
     106                        printf ("default emin");
     107                      else if (e >= LONG_MIN)
     108                        printf ("%ld", (long) e);
     109                      else
     110                        printf ("<LONG_MIN");
     111                      printf (") with mpfr_%s,\nx = %d/16, prec = %d, k = %d,"
     112                              " %s\n", div == 0 ? "mul_2si" : div == 1 ?
     113                              "div_2si" : "div_2ui", s * i, prec, k,
     114                              mpfr_print_rnd_mode ((mpfr_rnd_t) rnd));
     115                      printf ("Expected ");
     116                      mpfr_out_str (stdout, 16, 0, z1, MPFR_RNDN);
     117                      printf (", inex = %d, flags = %u\n",
     118                              SIGN (inex1), flags1);
     119                      printf ("Got      ");
     120                      mpfr_out_str (stdout, 16, 0, z2, MPFR_RNDN);
     121                      printf (", inex = %d, flags = %u\n",
     122                              SIGN (inex2), flags2);
     123                      exit (1);
     124                    }  /* div */
     125                }  /* k */
     126            mpfr_clears (z1, z2, (mpfr_ptr) 0);
     127          }  /* prec */
     128      }  /* i */
    124129  mpfr_clears (x, y, (mpfr_ptr) 0);
    125130  set_emin (emin);
    126131}
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.3-a/PATCHES mpfr-3.1.3-b/PATCHES
    old new  
     1frexp
  • mpfr-3.1.

    diff -Naurd mpfr-3.1.3-a/VERSION mpfr-3.1.3-b/VERSION
    old new  
    1 3.1.3-p3
     13.1.3-p4
  • src/frexp.c

    diff -Naurd mpfr-3.1.3-a/src/frexp.c mpfr-3.1.3-b/src/frexp.c
    old new  
    2626mpfr_frexp (mpfr_exp_t *exp, mpfr_ptr y, mpfr_srcptr x, mpfr_rnd_t rnd)
    2727{
    2828  int inex;
     29  unsigned int saved_flags = __gmpfr_flags;
     30  MPFR_BLOCK_DECL (flags);
     31
     32  MPFR_LOG_FUNC
     33    (("x[%Pu]=%.*Rg rnd=%d", mpfr_get_prec (x), mpfr_log_prec, x, rnd),
     34     ("y[%Pu]=%.*Rg exp=%" MPFR_EXP_FSPEC "d inex=%d", mpfr_get_prec (y),
     35      mpfr_log_prec, y, (mpfr_eexp_t) *exp, inex));
    2936
    3037  if (MPFR_UNLIKELY(MPFR_IS_SINGULAR(x)))
    3138    {
     
    4956        }
    5057    }
    5158
    52   inex = mpfr_set (y, x, rnd);
     59  MPFR_BLOCK (flags, inex = mpfr_set (y, x, rnd));
     60  __gmpfr_flags = saved_flags;
     61
     62  /* Possible overflow due to the rounding, no possible underflow. */
     63
     64  if (MPFR_UNLIKELY (MPFR_OVERFLOW (flags)))
     65    {
     66      int inex2;
     67
     68      /* An overflow here means that the exponent of y would be larger than
     69         the one of x, thus x would be rounded to the next power of 2, and
     70         the returned y should be 1/2 in absolute value, rounded (i.e. with
     71         possible underflow or overflow). This also implies that x and y are
     72         different objects, so that the exponent of x has not been lost. */
     73      MPFR_LOG_MSG (("Internal overflow\n", 0));
     74      MPFR_ASSERTD (x != y);
     75      *exp = MPFR_GET_EXP (x) + 1;
     76      inex2 = mpfr_set_si_2exp (y, MPFR_INT_SIGN (x), -1, rnd);
     77      MPFR_LOG_MSG (("inex=%d inex2=%d\n", inex, inex2));
     78      if (inex2 != 0)
     79        inex = inex2;
     80      MPFR_RET (inex);
     81    }
     82
    5383  *exp = MPFR_GET_EXP (y);
    54   MPFR_SET_EXP (y, 0);
     84  /* Do not use MPFR_SET_EXP because the range has not been checked yet. */
     85  MPFR_EXP (y) = 0;
    5586  return mpfr_check_range (y, inex, rnd);
    5687}
  • src/mpfr.h

    diff -Naurd mpfr-3.1.3-a/src/mpfr.h mpfr-3.1.3-b/src/mpfr.h
    old new  
    2727#define MPFR_VERSION_MAJOR 3
    2828#define MPFR_VERSION_MINOR 1
    2929#define MPFR_VERSION_PATCHLEVEL 3
    30 #define MPFR_VERSION_STRING "3.1.3-p3"
     30#define MPFR_VERSION_STRING "3.1.3-p4"
    3131
    3232/* Macros dealing with MPFR VERSION */
    3333#define MPFR_VERSION_NUM(a,b,c) (((a) << 16L) | ((b) << 8) | (c))
  • src/version.c

    diff -Naurd mpfr-3.1.3-a/src/version.c mpfr-3.1.3-b/src/version.c
    old new  
    2525const char *
    2626mpfr_get_version (void)
    2727{
    28   return "3.1.3-p3";
     28  return "3.1.3-p4";
    2929}
  • tests/tfrexp.c

    diff -Naurd mpfr-3.1.3-a/tests/tfrexp.c mpfr-3.1.3-b/tests/tfrexp.c
    old new  
    129129  mpfr_clear (x);
    130130}
    131131
     132static void check1 (void)
     133{
     134  mpfr_exp_t emin, emax, e;
     135  mpfr_t x, y1, y2;
     136  int r, neg, red;
     137
     138  emin = mpfr_get_emin ();
     139  emax = mpfr_get_emax ();
     140  set_emin (MPFR_EMIN_MIN);
     141  set_emax (MPFR_EMAX_MAX);
     142
     143  mpfr_init2 (x, 7);
     144  mpfr_inits2 (4, y1, y2, (mpfr_ptr) 0);
     145
     146  mpfr_set_ui_2exp (x, 1, -2, MPFR_RNDN);
     147  while (mpfr_regular_p (x))
     148    {
     149      /* Test the exponents up to 3 and with the maximum exponent
     150         (to check potential intermediate overflow). */
     151      if (MPFR_GET_EXP (x) == 4)
     152        mpfr_set_exp (x, MPFR_EMAX_MAX);
     153      e = MPFR_GET_EXP (x);
     154      for (neg = 0; neg < 2; neg++)
     155        {
     156          RND_LOOP (r)
     157            {
     158              int inex1, inex2;
     159              mpfr_exp_t e1, e2;
     160              unsigned int flags1, flags2;
     161
     162              for (red = 0; red < 2; red++)
     163                {
     164                  if (red)
     165                    {
     166                      /* e1: exponent of the rounded value of x. */
     167                      MPFR_ASSERTN (e1 == e || e1 == e + 1);
     168                      set_emin (e);
     169                      set_emax (e);
     170                      mpfr_clear_flags ();
     171                      inex1 = e1 < 0 ?
     172                        mpfr_mul_2ui (y1, x, -e1, (mpfr_rnd_t) r) :
     173                        mpfr_div_2ui (y1, x, e1, (mpfr_rnd_t) r);
     174                      flags1 = __gmpfr_flags;
     175                    }
     176                  else
     177                    {
     178                      inex1 = mpfr_set (y1, x, (mpfr_rnd_t) r);
     179                      e1 = MPFR_IS_INF (y1) ? e + 1 : MPFR_GET_EXP (y1);
     180                      flags1 = inex1 != 0 ? MPFR_FLAGS_INEXACT : 0;
     181                    }
     182                  mpfr_clear_flags ();
     183                  inex2 = mpfr_frexp (&e2, y2, x, (mpfr_rnd_t) r);
     184                  flags2 = __gmpfr_flags;
     185                  set_emin (MPFR_EMIN_MIN);
     186                  set_emax (MPFR_EMAX_MAX);
     187                  if ((!red || e == 0) &&
     188                      (! mpfr_regular_p (y2) || MPFR_GET_EXP (y2) != 0))
     189                    {
     190                      printf ("Error in check1 for %s, red = %d, x = ",
     191                              mpfr_print_rnd_mode ((mpfr_rnd_t) r), red);
     192                      mpfr_dump (x);
     193                      printf ("Expected 1/2 <= |y| < 1, got y = ");
     194                      mpfr_dump (y2);
     195                      exit (1);
     196                    }
     197                  if (!red)
     198                    {
     199                      if (e2 > 0)
     200                        mpfr_mul_2ui (y2, y2, e2, MPFR_RNDN);
     201                      else if (e2 < 0)
     202                        mpfr_div_2ui (y2, y2, -e2, MPFR_RNDN);
     203                    }
     204                  if (! (SAME_SIGN (inex1, inex2) &&
     205                         mpfr_equal_p (y1, y2) &&
     206                         flags1 == flags2))
     207                    {
     208                      printf ("Error in check1 for %s, red = %d, x = ",
     209                              mpfr_print_rnd_mode ((mpfr_rnd_t) r), red);
     210                      mpfr_dump (x);
     211                      printf ("Expected y1 = ");
     212                      mpfr_dump (y1);
     213                      printf ("Got      y2 = ");
     214                      mpfr_dump (y2);
     215                      printf ("Expected inex ~= %d, got %d\n", inex1, inex2);
     216                      printf ("Expected flags:");
     217                      flags_out (flags1);
     218                      printf ("Got flags:     ");
     219                      flags_out (flags2);
     220                      exit (1);
     221                    }
     222                }
     223            }
     224          mpfr_neg (x, x, MPFR_RNDN);
     225        }
     226      mpfr_nextabove (x);
     227    }
     228
     229  mpfr_clears (x, y1, y2, (mpfr_ptr) 0);
     230  set_emin (emin);
     231  set_emax (emax);
     232}
     233
    132234int
    133235main (int argc, char *argv[])
    134236{
    135237  tests_start_mpfr ();
    136238
    137239  check_special ();
     240  check1 ();
    138241
    139242  tests_end_mpfr ();
    140243  return 0;
Note: See TracBrowser for help on using the repository browser.