[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
6.3 Changed Functions
The following functions have changed after MPFR 2.2. Changes can affect the behavior of code written for some MPFR version when built and run against another MPFR version (older or newer), as described below.
-
mpfr_check_range
changed in MPFR 2.3.2 and MPFR 2.4. If the value is an inexact infinity, the overflow flag is now set (in case it was lost), while it was previously left unchanged. This is really what is expected in practice (and what the MPFR code was expecting), so that the previous behavior was regarded as a bug. Hence the change in MPFR 2.3.2. -
mpfr_get_f
changed in MPFR 3.0. This function was returning zero, except for NaN and Inf, which do not exist in MPF. The erange flag is now set in these cases, andmpfr_get_f
now returns the usual ternary value. -
mpfr_get_si
,mpfr_get_sj
,mpfr_get_ui
andmpfr_get_uj
changed in MPFR 3.0. In previous MPFR versions, the cases where the erange flag is set were unspecified. -
mpfr_get_z
changed in MPFR 3.0. The return type wasvoid
; it is nowint
, and the usual ternary value is returned. Thus programs that need to work with both MPFR 2.x and 3.x must not use the return value. Even in this case, C code usingmpfr_get_z
as the second or third term of a conditional operator may also be affected. For instance, the following is correct with MPFR 3.0, but not with MPFR 2.x:bool ? mpfr_get_z(...) : mpfr_add(...);
On the other hand, the following is correct with MPFR 2.x, but not with MPFR 3.0:
bool ? mpfr_get_z(...) : (void) mpfr_add(...);
Portable code should cast
mpfr_get_z(...)
tovoid
to use the typevoid
for both terms of the conditional operator, as in:bool ? (void) mpfr_get_z(...) : (void) mpfr_add(...);
Alternatively,
if ... else
can be used instead of the conditional operator.Moreover the cases where the erange flag is set were unspecified in MPFR 2.x.
-
mpfr_get_z_exp
changed in MPFR 3.0. In previous MPFR versions, the cases where the erange flag is set were unspecified. Note: this function has been renamed tompfr_get_z_2exp
in MPFR 3.0, butmpfr_get_z_exp
is still available for compatibility reasons. -
mpfr_strtofr
changed in MPFR 2.3.1 and MPFR 2.4. This was actually a bug fix since the code and the documentation did not match. But both were changed in order to have a more consistent and useful behavior. The main changes in the code are as follows. The binary exponent is now accepted even without the0b
or0x
prefix. Data corresponding to NaN can now have an optional sign (such data were previously invalid). -
mpfr_strtofr
changed in MPFR 3.0. This function now accepts bases from 37 to 62 (no changes for the other bases). Note: if an unsupported base is provided to this function, the behavior is undefined; more precisely, in MPFR 2.3.1 and later, providing an unsupported base yields an assertion failure (this behavior may change in the future). -
mpfr_subnormalize
changed in MPFR 3.0.1. This was actually regarded as a bug fix. Thempfr_subnormalize
implementation up to MPFR 3.0.0 did not change the flags. In particular, it did not follow the generic rule concerning the inexact flag (and no special behavior was specified). The case of the underflow flag was more a lack of specification.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |