manpagez: man pages & more
info mpfr
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.13 Advanced Functions

All the given interfaces are preliminary. They might change incompatibly in future revisions.

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 can not 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 compiler constant, your compiler must support ‘Variable-length automatic arrays’ (standard in ISO C99). ‘GCC 2.95.3’ 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_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).

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_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);
}

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© manpagez.com 2000-2025
Individual documents may contain additional copyright information.