mpz_get_d precision
Kevin Ryde
user42 at zip.com.au
Wed May 5 23:29:06 CEST 2004
Updated words on the get_d functions will be as follows.
The bits about hardware traps are because I don't want to try to
guarantee they will or won't occur. I'm fairly sure in the past some
cases trapped and some not, so this should be a no-change.
-- Function: double mpz_get_d (mpz_t OP)
Convert OP to a `double', truncating if necessary (ie. rounding
towards zero).
If the exponent from the conversion is too big, the result is
system dependent. An infinity is returned where available. A
hardware overflow trap may or may not occur.
-- Function: double mpz_get_d_2exp (signed long int *EXP, mpz_t OP)
Convert OP to a `double', truncating if necessary (ie. rounding
towards zero), and returning the exponent separately.
The return value is in the range 0.5<=abs(D)<1 and the exponent is
stored to `*EXP'. D * 2^EXP is the (truncated) OP value. If OP
is zero, the return is 0.0 and 0 is stored to `*EXP'.
This is similar to the standard C `frexp' function (*note
Normalization Functions: (libc)Normalization Functions.).
-- Function: double mpq_get_d (mpq_t OP)
Convert OP to a `double', truncating if necessary (ie. rounding
towards zero).
If the exponent from the conversion is too big or too small to fit
a `double' then the result is system dependent. For too big an
infinity is returned when available. For too small 0.0 is
returned. Hardware overflow, underflow and denorm traps may or
may not occur.
-- Function: double mpf_get_d (mpf_t OP)
Convert OP to a `double', truncating if necessary (ie. rounding
towards zero).
If the exponent in OP is too big or too small to fit a `double'
then the result is system dependent. For too big an infinity is
returned when available. For too small 0.0 is returned. Hardware
overflow, underflow and denorm traps may or may not occur.
-- Function: double mpf_get_d_2exp (signed long int *EXP, mpf_t OP)
Convert OP to a `double', truncating if necessary (ie. rounding
towards zero), and with an exponent returned separately.
The return value is in the range 0.5<=abs(D)<1 and the exponent is
stored to `*EXP'. D * 2^EXP is the (truncated) OP value. If OP
is zero, the return is 0.0 and 0 is stored to `*EXP'.
This is similar to the standard C `frexp' function (*note
Normalization Functions: (libc)Normalization Functions.).
More information about the gmp-devel
mailing list