| [ < ] | [ > ] | [ << ] | [ 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_rangechanged 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_fchanged 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_fnow returns the usual ternary value. -
mpfr_get_si,mpfr_get_sj,mpfr_get_uiandmpfr_get_ujchanged in MPFR 3.0. In previous MPFR versions, the cases where the erange flag is set were unspecified. -
mpfr_get_zchanged 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_zas 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(...)tovoidto use the typevoidfor both terms of the conditional operator, as in:bool ? (void) mpfr_get_z(...) : (void) mpfr_add(...);
Alternatively,
if ... elsecan 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_expchanged 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_2expin MPFR 3.0, butmpfr_get_z_expis still available for compatibility reasons. -
mpfr_strtofrchanged 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 the0bor0xprefix. Data corresponding to NaN can now have an optional sign (such data were previously invalid). -
mpfr_strtofrchanged 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_subnormalizechanged in MPFR 3.0.1. This was actually regarded as a bug fix. Thempfr_subnormalizeimplementation 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] | [ ? ] |
