diff options
author | Kevin Ryde <user42@zip.com.au> | 2001-11-07 22:57:52 +0100 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2001-11-07 22:57:52 +0100 |
commit | 8979cb56a5b7844a043e2d79e592e069fdcdfd72 (patch) | |
tree | d377d02f787907f9538ae122b514db89b5680e94 /gmp-impl.h | |
parent | ee03e1899ff0af936d5b6db67e9b3725aad73c19 (diff) | |
download | gmp-8979cb56a5b7844a043e2d79e592e069fdcdfd72.tar.gz |
* gmp-h.in, gmp-impl.h, mpf/abs.c, mpf/neg.c, mpf/get_prc.c,
mpf/get_dfl_prec.c, mpf/set_dfl_prec.c, mpf/set_prc_raw.c,
mpf/set_si.c, mpf/set_ui.c, mpf/size.c: Revert mpf inlining, in order
to leave open the possibility of keeping binary compatibility if mpf
becomes mpfr.
Diffstat (limited to 'gmp-impl.h')
-rw-r--r-- | gmp-impl.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gmp-impl.h b/gmp-impl.h index 4148c8513..f901bc06d 100644 --- a/gmp-impl.h +++ b/gmp-impl.h @@ -2122,6 +2122,17 @@ void __gmp_sqrt_of_negative _PROTO ((void)) ATTRIBUTE_NORETURN; } while (0) +/* __GMPF_BITS_TO_PREC applies a minimum 53 bits, rounds upwards to a whole + limb and adds an extra limb. __GMPF_PREC_TO_BITS drops that extra limb, + hence giving back the user's size in bits rounded up. Notice that + converting prec->bits->prec gives an unchanged value. */ +#define __GMPF_BITS_TO_PREC(n) \ + ((mp_size_t) ((__GMP_MAX (53, n) + 2 * __GMP_BITS_PER_MP_LIMB - 1) \ + / __GMP_BITS_PER_MP_LIMB)) +#define __GMPF_PREC_TO_BITS(n) \ + ((unsigned long) (n) * __GMP_BITS_PER_MP_LIMB - __GMP_BITS_PER_MP_LIMB) + + /* Set n to the number of significant digits an mpf of the given _mp_prec field, in the given base. This is a rounded up value, designed to ensure there's enough digits to reproduce all the guaranteed part of the value. |