Next: Compatibility with MPF, Previous: Exception Related Functions, Up: MPFR Interface
All the given interfaces are preliminary. They might change incompatibly in future revisions.
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 usingmpfr_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 theMPFR_DECL_INIT
implementation.
Initialize all the
mpfr_t
variables of the givenva_list
, set their precision to be the default precision and their value to NaN. Seempfr_init
for more details. Theva_list
is assumed to be composed only of typempfr_t
(or equivalentlympfr_ptr
). It begins from x. It ends when it encounters a null pointer (whose type must also bempfr_ptr
).
Initialize all the
mpfr_t
variables of the givenva_list
, set their precision to be exactly prec bits and their value to NaN. Seempfr_init2
for more details. Theva_list
is assumed to be composed only of typempfr_t
(or equivalentlympfr_ptr
). It begins from x. It ends when it encounters a null pointer (whose type must also bempfr_ptr
).
Free the space occupied by all the
mpfr_t
variables of the givenva_list
. Seempfr_clear
for more details. Theva_list
is assumed to be composed only of typempfr_t
(or equivalentlympfr_ptr
). It begins from x. It ends when it encounters a null pointer (whose type must also bempfr_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); }