 Functions
============================

An `mpfr_t' object must be initialized before storing the first value in
it.  The functions `mpfr_init' and `mpfr_init2' are used for that
purpose.

 -- Function: void mpfr_init2 (mpfr_t X, mp_prec_t PREC)
     Initialize X, set its precision to be *exactly* PREC bits and its
     value to NaN. (Warning: the corresponding `mpf' functions
     initialize to zero instead.)

     Normally, a variable should be initialized once only or at least
     be cleared, using `mpfr_clear', between initializations.  To
     change the precision of a variable which has already been
     initialized, use `mpfr_set_prec'.  The precision PREC must be an
     integer between `MPFR_PREC_MIN' and `MPFR_PREC_MAX' (otherwise the
     behavior is undefined).

 -- Function: void mpfr_inits2 (mp_prec_t PREC, mpfr_t X, ...)
     Initialize all the `mpfr_t' variables of the given `va_list', set
     their precision to be *exactly* PREC bits and their value to NaN.
     See `mpfr_init2' for more details.  The `va_list' is assumed to be
     composed only of type `mpfr_t' (or equivalently `mpfr_ptr').  It
     begins from X. It ends when it encounters a null pointer (whose
     type must also be `mpfr_ptr').

 -- Function: void mpfr_clear (mpfr_t X)
     Free the space occupied by X.  Make sure to call this function for
     all `mpfr_t' variables when you are done with them.

 -- Function: void mpfr_clears (mpfr_t X, ...)
     Free the space occupied by all the `mpfr_t' variables of the given
     `va_list'. See `mpfr_clear' for more details.  The `va_list' is
     assumed to be composed only of type `mpfr_t' (or equivalently
     `mpfr_ptr').  It begins from X. It ends when it encounters a null
     pointer (whose type must also be `mpfr_ptr').

   Here is an example of how to use multiple initialization functions:

     {
       mpfr_t x, y, z, t;
       mpfr_inits2 (256, x, y, z, t, (mpfr_ptr) 0);
       ...
       mpfr_clears (x, y, z, t, (mpfr_ptr) 0);
     }

 -- Function: void mpfr_init (mpfr_t X)
     Initialize X and set its value to NaN.

     Normally, a variable should be initialized once only or at least
     be cleared, using `mpfr_clear', between initializations.  The
     precision of X is the default precision, which can be changed by a
     call to `mpfr_set_default_prec'.

     Warning! In a given program, some other libraries might change the
     default precision and not restore it. Thus it is safer to use
     `mpfr_init2'.

 -- Function: void mpfr_inits (mpfr_t X, ...)
     Initialize all the `mpfr_t' variables of the given `va_list', set
     their precision to be the default precision and their value to NaN.
     See `mpfr_init' for more details.  The `va_list' is assumed to be
     composed only of type `mpfr_t' (or equivalently `mpfr_ptr').  It
     begins from X. It ends when it encounters a null pointer (whose
     type must also be `mpfr_ptr').

     Warning! In a given program, some other libraries might change the
     default precision and not restore it. Thus it is safer to use
     `mpfr_inits2'.

 -- Macro: MPFR_DECL_INIT (NAME, PREC)
     This macro declares NAME as an automatic variable of type `mpfr_t',
     initializes it and sets its precision to be *exactly* PREC bits
     and its value to NaN. NAME must be a valid identifier.  You must
     use this macro in the declaration section.  This macro is much
     faster than using `mpfr_init2' but has some drawbacks:

        * You *must not* call `mpfr_clear' with variables created with
          this macro (the storage is allocated at the point of
          declaration and deallocated when the brace-level is exited).

        * You *cannot* change their precision.

        * You *should not* create variables with huge precision with
          this macro.

        * Your compiler must support `Non-Constant Initializers'
          (standard in C++ and ISO C99) and `Token Pasting' (standard
          in ISO C89). If PREC is not a constant expression, your
          compiler must support `variable-length automatic arrays'
          (standard in ISO C99). `GCC 2.95.3' and above supports all
          these features.  If you compile your program with gcc in c89
          mode and with `-pedantic', you may want to define the
          `MPFR_USE_EXTENSION' macro to avoid warnings due to the
          `MPFR_DECL_INIT' implementation.

 -- Function: void mpfr_set_default_prec (mp_prec_t PREC)
     Set the default precision to be *exactly* PREC bits.  The
     precision of a variable means the number of bits used to store its
     significand.  All subsequent calls to `mpfr_init' will use this
     precision, but previously initialized variables are unaffected.
     This default precision is set to 53 bits initially.  The precision
     can be any integer between `MPFR_PREC_MIN' and `MPFR_PREC_MAX'.

 -- Function: mp_prec_t mpfr_get_default_prec (void)
     Return the default MPFR precision in bits.

   Here is an example on how to initialize floating-point variables:

     {
       mpfr_t x, y;
       mpfr_init (x);                /* use default precision */
       mpfr_init2 (y, 256);          /* precision _exactly_ 256 bits */
       ...
       /* When the program is about to exit, do ... */
       mpfr_clear (x);
       mpfr_clear (y);
       mpfr_free_cache ();
     }

   The following functions are useful for changing the precision during
a calculation.  A typical use would be for adjusting the precision
gradually in iterative algorithms like Newton-Raphson, making the
computation precision closely match the actual accurate part of the
numbers.

 -- Function: void mpfr_set_prec (mpfr_t X, mp_prec_t PREC)
     Reset the precision of X to be *exactly* PREC bits, and set its
     value to NaN.  The previous value stored in X is lost. It is
     equivalent to a call to `mpfr_clear(x)' followed by a call to
     `mpfr_init2(x, prec)', but more efficient as no allocation is done
     in case the current allocated space for the significand of X is
     enough.  The precision PREC can be any integer between
     `MPFR_PREC_MIN' and `MPFR_PREC_MAX'.

     In case you want to keep the previous value stored in X, use
     `mpfr_prec_round' instead.

 -- Function: mp_prec_t mpfr_get_prec (mpfr_t X)
     Return the precision actually used for assignments of X, i.e. the
     number of bits used to store its significand.

