diff options
author | Kevin Ryde <user42@zip.com.au> | 2001-07-06 23:58:09 +0200 |
---|---|---|
committer | Kevin Ryde <user42@zip.com.au> | 2001-07-06 23:58:09 +0200 |
commit | 6c9d69ea2e93a2410d20337d8ab0c6267241d30b (patch) | |
tree | 470e5f6bae7446abb472d09d4fd6f6c7d90c4843 /gmp.texi | |
parent | 36e8c6af64ae7c712731b17c0fc7cc2952179fb6 (diff) | |
download | gmp-6c9d69ea2e93a2410d20337d8ab0c6267241d30b.tar.gz |
* gmp-h.in (mpq_cmp_si): Add prototype.
* gmp.texi (Comparing Rationals): Add doco.
And a few tweaks to the mpf intro.
Diffstat (limited to 'gmp.texi')
-rw-r--r-- | gmp.texi | 38 |
1 files changed, 19 insertions, 19 deletions
@@ -3283,15 +3283,16 @@ To determine if two rationals are equal, @code{mpq_equal} is faster than @end deftypefun @deftypefn Macro int mpq_cmp_ui (mpq_t @var{op1}, unsigned long int @var{num2}, unsigned long int @var{den2}) +@deftypefnx Macro int mpq_cmp_si (mpq_t @var{op1}, long int @var{num2}, unsigned long int @var{den2}) Compare @var{op1} and @var{num2}/@var{den2}. Return a positive value if @ma{@var{op1} > @var{num2}/@var{den2}}, zero if @ma{@var{op1} = @var{num2}/@var{den2}}, and a negative value if @ma{@var{op1} < @var{num2}/@var{den2}}. -This routine allows that @var{num2} and @var{den2} have common factors. +@var{num2} and @var{den2} are allowed to have common factors. -This function is actually implemented as a macro. It evaluates its -arguments multiple times. +These functions are implemented as a macros and evaluate their arguments +multiple times. @end deftypefn @deftypefn Macro int mpq_sgn (mpq_t @var{op}) @@ -3379,32 +3380,31 @@ GMP floating point numbers are stored in objects of type @code{mpf_t} and functions operating on them have an @code{mpf_} prefix. The mantissa of each float has a user-selectable precision, limited only by -available memory. Each variable has its own precision, which can be increased -or decreased at any time. +available memory. Each variable has its own precision, and it can be +increased or decreased at any time. The exponent of each float is a fixed precision, one machine word on most systems. In the current implementation the exponent is a count of limbs, so for example on a 32-bit system this means a range of roughly @ma{2^@W{-68719476768}} to @ma{2^@W{68719476736}}, or on a 64-bit system this -will be greater. However @code{mpf_get_str} can only return an exponent which -fits an @code{mp_exp_t} and currently <code>mpf_set_str</code> doesn't accept +will be greater. Note however @code{mpf_get_str} can only return an exponent +which fits an @code{mp_exp_t} and currently @code{mpf_set_str} doesn't accept exponents bigger than a @code{long}. -In each variable the current size of the mantissa data is maintained. This -means that if the mantissa is exactly represented in only a few bits then only -those bits will be used in a calculation, even if the selected precision is -high. +Each variable keeps a size for the mantissa data actually in use. This means +that if a float is exactly represented in only a few bits then only those bits +will be used in a calculation, even if the selected precision is high. All calculations are performed to the precision of the destination variable. Each function is defined to calculate with ``infinite precision'' followed by -a truncation to the destination precision, but of course the actual work done -is only what's needed to determine a result under that definition. - -The precision set for each variable is actually a minimum value, GMP may -increase it a little to facilitate efficient calculation. Currently this -means rounding up to a whole limb, and then sometimes having a further partial -limb, depending on the high limb of the mantissa. But applications shouldn't -be concerned by such details. +a truncation to the destination precision, but of course the work done is only +what's needed to determine a result under that definition. + +The precision selected for a variable is a minimum value, GMP may increase it +a little to facilitate efficient calculation. Currently this means rounding +up to a whole limb, and then sometimes having a further partial limb, +depending on the high limb of the mantissa. But applications shouldn't be +concerned by such details. @code{mpf} functions and variables have no special notion of infinity or not-a-number, and applications must take care not to overflow the exponent or |