| [ < ] | [ > ] | [ << ] | [ 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 usingmpfr_init2but has some drawbacks:- You must not call
mpfr_clearwith 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_EXTENSIONmacro to avoid warnings due to theMPFR_DECL_INITimplementation.
- You must not call
- Function: void mpfr_inits (mpfr_t x, ...)
Initialize all the
mpfr_tvariables of the givenva_list, set their precision to be the default precision and their value to NaN. Seempfr_initfor more details. Theva_listis 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).
- Function: void mpfr_inits2 (mp_prec_t prec, mpfr_t x, ...)
Initialize all the
mpfr_tvariables of the givenva_list, set their precision to be exactly prec bits and their value to NaN. Seempfr_init2for more details. Theva_listis 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).
- Function: void mpfr_clears (mpfr_t x, ...)
Free the space occupied by all the
mpfr_tvariables of the givenva_list. Seempfr_clearfor more details. Theva_listis 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);
}
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
