summaryrefslogtreecommitdiff
path: root/doc/README.dev
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-02-16 14:32:58 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2018-02-16 14:32:58 +0000
commit2d24474c95338b8af3cb1185f192835278c1dfb3 (patch)
treed1c4ff52fb284464bcc58521660d6158d5f33a38 /doc/README.dev
parent3d9a7fdb07b0fbd51e89aaf69043ef0a19cdfc5f (diff)
downloadmpfr-2d24474c95338b8af3cb1185f192835278c1dfb3.tar.gz
[doc/README.dev] Update about mpfr_exp_t.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@12271 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'doc/README.dev')
-rw-r--r--doc/README.dev18
1 files changed, 12 insertions, 6 deletions
diff --git a/doc/README.dev b/doc/README.dev
index 8155d0948..b60f01167 100644
--- a/doc/README.dev
+++ b/doc/README.dev
@@ -1071,7 +1071,7 @@ conversions). If such a signed type contains a negative value, the
result will probably be incorrect. With MPFR 2.x, this problem could
arise with mpfr_exp_t, which is signed, and mpfr_prec_t (mp_prec_t),
which was unsigned (it is now signed), meaning that in general, a cast
-of a mpfr_prec_t into a mpfr_exp_t was needed.
+of a mpfr_prec_t to a mpfr_exp_t was needed.
Note that such bugs are difficult to detect because they may depend on
the platform (e.g., on LP64, 32-bit unsigned int + 64-bit long is OK,
@@ -1099,7 +1099,7 @@ the MPFR versions: MPFR_UINTMAX_MAX, MPFR_INTMAX_MAX and MPFR_INTMAX_MIN.
Use mpfr_prec_t and mpfr_rnd_t instead of the old types mp_prec_t and
mp_rnd_t. Similarly, use mpfr_exp_t instead of GMP's mp_exp_t type
(unless you really want mp_exp_t, e.g. for conversions with mpf; but
-you should not assume that mpfr_exp_t and mp_exp_t are identical).
+you must not assume that mpfr_exp_t and mp_exp_t are identical).
===========================================================================
@@ -1132,12 +1132,18 @@ in the MPFR source depends on the context.
More on exponent handling:
+* The mpfr_exp_t type has at least 32 bits since it must contain the
+ default exponent range.
+
+* The range of valid exponents is defined so that if a and b are two
+ valid exponents (i.e. between MPFR_EMIN_MIN and MPFR_EMAX_MAX), then
+ ± a ± b ± 1 fits in a mpfr_exp_t.
+
* The unsigned type corresponding to mpfr_exp_t is mpfr_uexp_t. It may be
useful if the considered values are nonnegative and don't necessarily
- fit in mpfr_exp_t. To convert a mpfr_exp_t to mpfr_uexp_t, you should
- use the MPFR_UEXP macro, as in debug mode, it checks that the value is
- nonnegative (in future MPFR versions, MPFR_UEXP could tell the compiler
- that the value is nonnegative, possibly allowing more optimization).
+ fit in mpfr_exp_t. To convert a nonnegative mpfr_exp_t to mpfr_uexp_t,
+ you should use the MPFR_UEXP macro, which is defined as:
+ #define MPFR_UEXP(X) (MPFR_ASSERTD ((X) >= 0), (mpfr_uexp_t) (X))
* If a mpfr_exp_t appears in arithmetic expressions together with ISO C90
types int and/or long, computations must be done with the largest type,