xref: /dragonfly/contrib/mpfr/doc/mpfr.info (revision 6e5c5008)
1This is mpfr.info, produced by makeinfo version 4.13 from mpfr.texi.
2
3This manual documents how to install and use the Multiple Precision
4Floating-Point Reliable Library, version 3.1.2.
5
6   Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
72001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
82013 Free Software Foundation, Inc.
9
10   Permission is granted to copy, distribute and/or modify this
11document under the terms of the GNU Free Documentation License, Version
121.2 or any later version published by the Free Software Foundation;
13with no Invariant Sections, with no Front-Cover Texts, and with no
14Back-Cover Texts.  A copy of the license is included in *note GNU Free
15Documentation License::.
16
17INFO-DIR-SECTION Software libraries
18START-INFO-DIR-ENTRY
19* mpfr: (mpfr).                 Multiple Precision Floating-Point Reliable Library.
20END-INFO-DIR-ENTRY
21
22
23File: mpfr.info,  Node: Top,  Next: Copying,  Prev: (dir),  Up: (dir)
24
25GNU MPFR
26********
27
28   This manual documents how to install and use the Multiple Precision
29Floating-Point Reliable Library, version 3.1.2.
30
31   Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
322001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012,
332013 Free Software Foundation, Inc.
34
35   Permission is granted to copy, distribute and/or modify this
36document under the terms of the GNU Free Documentation License, Version
371.2 or any later version published by the Free Software Foundation;
38with no Invariant Sections, with no Front-Cover Texts, and with no
39Back-Cover Texts.  A copy of the license is included in *note GNU Free
40Documentation License::.
41
42
43* Menu:
44
45* Copying::                     MPFR Copying Conditions (LGPL).
46* Introduction to MPFR::        Brief introduction to GNU MPFR.
47* Installing MPFR::             How to configure and compile the MPFR library.
48* Reporting Bugs::              How to usefully report bugs.
49* MPFR Basics::                 What every MPFR user should now.
50* MPFR Interface::              MPFR functions and macros.
51* API Compatibility::           API compatibility with previous MPFR versions.
52* Contributors::
53* References::
54* GNU Free Documentation License::
55* Concept Index::
56* Function and Type Index::
57
58
59File: mpfr.info,  Node: Copying,  Next: Introduction to MPFR,  Prev: Top,  Up: Top
60
61MPFR Copying Conditions
62***********************
63
64The GNU MPFR library (or MPFR for short) is "free"; this means that
65everyone is free to use it and free to redistribute it on a free basis.
66The library is not in the public domain; it is copyrighted and there
67are restrictions on its distribution, but these restrictions are
68designed to permit everything that a good cooperating citizen would
69want to do.  What is not allowed is to try to prevent others from
70further sharing any version of this library that they might get from
71you.
72
73   Specifically, we want to make sure that you have the right to give
74away copies of the library, that you receive source code or else can
75get it if you want it, that you can change this library or use pieces
76of it in new free programs, and that you know you can do these things.
77
78   To make sure that everyone has such rights, we have to forbid you to
79deprive anyone else of these rights.  For example, if you distribute
80copies of the GNU MPFR library, you must give the recipients all the
81rights that you have.  You must make sure that they, too, receive or
82can get the source code.  And you must tell them their rights.
83
84   Also, for our own protection, we must make certain that everyone
85finds out that there is no warranty for the GNU MPFR library.  If it is
86modified by someone else and passed on, we want their recipients to
87know that what they have is not what we distributed, so that any
88problems introduced by others will not reflect on our reputation.
89
90   The precise conditions of the license for the GNU MPFR library are
91found in the Lesser General Public License that accompanies the source
92code.  See the file COPYING.LESSER.
93
94
95File: mpfr.info,  Node: Introduction to MPFR,  Next: Installing MPFR,  Prev: Copying,  Up: Top
96
971 Introduction to MPFR
98**********************
99
100MPFR is a portable library written in C for arbitrary precision
101arithmetic on floating-point numbers. It is based on the GNU MP library.
102It aims to provide a class of floating-point numbers with precise
103semantics. The main characteristics of MPFR, which make it differ from
104most arbitrary precision floating-point software tools, are:
105
106   * the MPFR code is portable, i.e., the result of any operation does
107     not depend on the machine word size `mp_bits_per_limb' (64 on most
108     current processors);
109
110   * the precision in bits can be set _exactly_ to any valid value for
111     each variable (including very small precision);
112
113   * MPFR provides the four rounding modes from the IEEE 754-1985
114     standard, plus away-from-zero, as well as for basic operations as
115     for other mathematical functions.
116
117   In particular, with a precision of 53 bits, MPFR is able to exactly
118reproduce all computations with double-precision machine floating-point
119numbers (e.g., `double' type in C, with a C implementation that
120rigorously follows Annex F of the ISO C99 standard and `FP_CONTRACT'
121pragma set to `OFF') on the four arithmetic operations and the square
122root, except the default exponent range is much wider and subnormal
123numbers are not implemented (but can be emulated).
124
125   This version of MPFR is released under the GNU Lesser General Public
126License, version 3 or any later version.  It is permitted to link MPFR
127to most non-free programs, as long as when distributing them the MPFR
128source code and a means to re-link with a modified MPFR library is
129provided.
130
1311.1 How to Use This Manual
132==========================
133
134Everyone should read *note MPFR Basics::.  If you need to install the
135library yourself, you need to read *note Installing MPFR::, too.  To
136use the library you will need to refer to *note MPFR Interface::.
137
138   The rest of the manual can be used for later reference, although it
139is probably a good idea to glance through it.
140
141
142File: mpfr.info,  Node: Installing MPFR,  Next: Reporting Bugs,  Prev: Introduction to MPFR,  Up: Top
143
1442 Installing MPFR
145*****************
146
147The MPFR library is already installed on some GNU/Linux distributions,
148but the development files necessary to the compilation such as `mpfr.h'
149are not always present. To check that MPFR is fully installed on your
150computer, you can check the presence of the file `mpfr.h' in
151`/usr/include', or try to compile a small program having `#include
152<mpfr.h>' (since `mpfr.h' may be installed somewhere else). For
153instance, you can try to compile:
154
155     #include <stdio.h>
156     #include <mpfr.h>
157     int main (void)
158     {
159       printf ("MPFR library: %-12s\nMPFR header:  %s (based on %d.%d.%d)\n",
160               mpfr_get_version (), MPFR_VERSION_STRING, MPFR_VERSION_MAJOR,
161               MPFR_VERSION_MINOR, MPFR_VERSION_PATCHLEVEL);
162       return 0;
163     }
164
165with
166
167     cc -o version version.c -lmpfr -lgmp
168
169and if you get errors whose first line looks like
170
171     version.c:2:19: error: mpfr.h: No such file or directory
172
173then MPFR is probably not installed. Running this program will give you
174the MPFR version.
175
176   If MPFR is not installed on your computer, or if you want to install
177a different version, please follow the steps below.
178
1792.1 How to Install
180==================
181
182Here are the steps needed to install the library on Unix systems (more
183details are provided in the `INSTALL' file):
184
185  1. To build MPFR, you first have to install GNU MP (version 4.1 or
186     higher) on your computer.  You need a C compiler, preferably GCC,
187     but any reasonable compiler should work.  And you need the
188     standard Unix `make' command, plus some other standard Unix
189     utility commands.
190
191     Then, in the MPFR build directory, type the following commands.
192
193  2. `./configure'
194
195     This will prepare the build and setup the options according to
196     your system.  You can give options to specify the install
197     directories (instead of the default `/usr/local'), threading
198     support, and so on. See the `INSTALL' file and/or the output of
199     `./configure --help' for more information, in particular if you
200     get error messages.
201
202  3. `make'
203
204     This will compile MPFR, and create a library archive file
205     `libmpfr.a'.  On most platforms, a dynamic library will be
206     produced too.
207
208  4. `make check'
209
210     This will make sure MPFR was built correctly.  If you get error
211     messages, please report this to the MPFR mailing-list
212     `mpfr@inria.fr'.  (*Note Reporting Bugs::, for information on what
213     to include in useful bug reports.)
214
215  5. `make install'
216
217     This will copy the files `mpfr.h' and `mpf2mpfr.h' to the directory
218     `/usr/local/include', the library files (`libmpfr.a' and possibly
219     others) to the directory `/usr/local/lib', the file `mpfr.info' to
220     the directory `/usr/local/share/info', and some other documentation
221     files to the directory `/usr/local/share/doc/mpfr' (or if you
222     passed the `--prefix' option to `configure', using the prefix
223     directory given as argument to `--prefix' instead of `/usr/local').
224
2252.2 Other `make' Targets
226========================
227
228There are some other useful make targets:
229
230   * `mpfr.info' or `info'
231
232     Create or update an info version of the manual, in `mpfr.info'.
233
234     This file is already provided in the MPFR archives.
235
236   * `mpfr.pdf' or `pdf'
237
238     Create a PDF version of the manual, in `mpfr.pdf'.
239
240   * `mpfr.dvi' or `dvi'
241
242     Create a DVI version of the manual, in `mpfr.dvi'.
243
244   * `mpfr.ps' or `ps'
245
246     Create a Postscript version of the manual, in `mpfr.ps'.
247
248   * `mpfr.html' or `html'
249
250     Create a HTML version of the manual, in several pages in the
251     directory `doc/mpfr.html'; if you want only one output HTML file,
252     then type `makeinfo --html --no-split mpfr.texi' from the `doc'
253     directory instead.
254
255   * `clean'
256
257     Delete all object files and archive files, but not the
258     configuration files.
259
260   * `distclean'
261
262     Delete all generated files not included in the distribution.
263
264   * `uninstall'
265
266     Delete all files copied by `make install'.
267
2682.3 Build Problems
269==================
270
271In case of problem, please read the `INSTALL' file carefully before
272reporting a bug, in particular section "In case of problem".  Some
273problems are due to bad configuration on the user side (not specific to
274MPFR). Problems are also mentioned in the FAQ
275`http://www.mpfr.org/faq.html'.
276
277   Please report problems to the MPFR mailing-list `mpfr@inria.fr'.
278*Note Reporting Bugs::.  Some bug fixes are available on the MPFR 3.1.2
279web page `http://www.mpfr.org/mpfr-3.1.2/'.
280
2812.4 Getting the Latest Version of MPFR
282======================================
283
284The latest version of MPFR is available from
285`ftp://ftp.gnu.org/gnu/mpfr/' or `http://www.mpfr.org/'.
286
287
288File: mpfr.info,  Node: Reporting Bugs,  Next: MPFR Basics,  Prev: Installing MPFR,  Up: Top
289
2903 Reporting Bugs
291****************
292
293If you think you have found a bug in the MPFR library, first have a look
294on the MPFR 3.1.2 web page `http://www.mpfr.org/mpfr-3.1.2/' and the
295FAQ `http://www.mpfr.org/faq.html': perhaps this bug is already known,
296in which case you may find there a workaround for it.  You might also
297look in the archives of the MPFR mailing-list:
298`https://sympa.inria.fr/sympa/arc/mpfr'.  Otherwise, please investigate
299and report it.  We have made this library available to you, and it is
300not to ask too much from you, to ask you to report the bugs that you
301find.
302
303   There are a few things you should think about when you put your bug
304report together.
305
306   You have to send us a test case that makes it possible for us to
307reproduce the bug, i.e., a small self-content program, using no other
308library than MPFR.  Include instructions on how to run the test case.
309
310   You also have to explain what is wrong; if you get a crash, or if
311the results you get are incorrect and in that case, in what way.
312
313   Please include compiler version information in your bug report. This
314can be extracted using `cc -V' on some machines, or, if you're using
315GCC, `gcc -v'. Also, include the output from `uname -a' and the MPFR
316version (the GMP version may be useful too).  If you get a failure
317while running `make' or `make check', please include the `config.log'
318file in your bug report.
319
320   If your bug report is good, we will do our best to help you to get a
321corrected version of the library; if the bug report is poor, we will
322not do anything about it (aside of chiding you to send better bug
323reports).
324
325   Send your bug report to the MPFR mailing-list `mpfr@inria.fr'.
326
327   If you think something in this manual is unclear, or downright
328incorrect, or if the language needs to be improved, please send a note
329to the same address.
330
331
332File: mpfr.info,  Node: MPFR Basics,  Next: MPFR Interface,  Prev: Reporting Bugs,  Up: Top
333
3344 MPFR Basics
335*************
336
337* Menu:
338
339* Headers and Libraries::
340* Nomenclature and Types::
341* MPFR Variable Conventions::
342* Rounding Modes::
343* Floating-Point Values on Special Numbers::
344* Exceptions::
345* Memory Handling::
346
347
348File: mpfr.info,  Node: Headers and Libraries,  Next: Nomenclature and Types,  Prev: MPFR Basics,  Up: MPFR Basics
349
3504.1 Headers and Libraries
351=========================
352
353All declarations needed to use MPFR are collected in the include file
354`mpfr.h'.  It is designed to work with both C and C++ compilers.  You
355should include that file in any program using the MPFR library:
356
357     #include <mpfr.h>
358
359   Note however that prototypes for MPFR functions with `FILE *'
360parameters are provided only if `<stdio.h>' is included too (before
361`mpfr.h'):
362
363     #include <stdio.h>
364     #include <mpfr.h>
365
366   Likewise `<stdarg.h>' (or `<varargs.h>') is required for prototypes
367with `va_list' parameters, such as `mpfr_vprintf'.
368
369   And for any functions using `intmax_t', you must include
370`<stdint.h>' or `<inttypes.h>' before `mpfr.h', to allow `mpfr.h' to
371define prototypes for these functions. Moreover, users of C++ compilers
372under some platforms may need to define `MPFR_USE_INTMAX_T' (and should
373do it for portability) before `mpfr.h' has been included; of course, it
374is possible to do that on the command line, e.g., with
375`-DMPFR_USE_INTMAX_T'.
376
377   Note: If `mpfr.h' and/or `gmp.h' (used by `mpfr.h') are included
378several times (possibly from another header file), `<stdio.h>' and/or
379`<stdarg.h>' (or `<varargs.h>') should be included *before the first
380inclusion* of `mpfr.h' or `gmp.h'.  Alternatively, you can define
381`MPFR_USE_FILE' (for MPFR I/O functions) and/or `MPFR_USE_VA_LIST' (for
382MPFR functions with `va_list' parameters) anywhere before the last
383inclusion of `mpfr.h'.  As a consequence, if your file is a public
384header that includes `mpfr.h', you need to use the latter method.
385
386   When calling a MPFR macro, it is not allowed to have previously
387defined a macro with the same name as some keywords (currently `do',
388`while' and `sizeof').
389
390   You can avoid the use of MPFR macros encapsulating functions by
391defining the `MPFR_USE_NO_MACRO' macro before `mpfr.h' is included.  In
392general this should not be necessary, but this can be useful when
393debugging user code: with some macros, the compiler may emit spurious
394warnings with some warning options, and macros can prevent some
395prototype checking.
396
397   All programs using MPFR must link against both `libmpfr' and
398`libgmp' libraries.  On a typical Unix-like system this can be done
399with `-lmpfr -lgmp' (in that order), for example:
400
401     gcc myprogram.c -lmpfr -lgmp
402
403   MPFR is built using Libtool and an application can use that to link
404if desired, *note GNU Libtool: (libtool.info)Top.
405
406   If MPFR has been installed to a non-standard location, then it may be
407necessary to set up environment variables such as `C_INCLUDE_PATH' and
408`LIBRARY_PATH', or use `-I' and `-L' compiler options, in order to
409point to the right directories. For a shared library, it may also be
410necessary to set up some sort of run-time library path (e.g.,
411`LD_LIBRARY_PATH') on some systems. Please read the `INSTALL' file for
412additional information.
413
414
415File: mpfr.info,  Node: Nomenclature and Types,  Next: MPFR Variable Conventions,  Prev: Headers and Libraries,  Up: MPFR Basics
416
4174.2 Nomenclature and Types
418==========================
419
420A "floating-point number", or "float" for short, is an arbitrary
421precision significand (also called mantissa) with a limited precision
422exponent. The C data type for such objects is `mpfr_t' (internally
423defined as a one-element array of a structure, and `mpfr_ptr' is the C
424data type representing a pointer to this structure). A floating-point
425number can have three special values: Not-a-Number (NaN) or plus or
426minus Infinity. NaN represents an uninitialized object, the result of
427an invalid operation (like 0 divided by 0), or a value that cannot be
428determined (like +Infinity minus +Infinity). Moreover, like in the IEEE
429754 standard, zero is signed, i.e., there are both +0 and -0; the
430behavior is the same as in the IEEE 754 standard and it is generalized
431to the other functions supported by MPFR. Unless documented otherwise,
432the sign bit of a NaN is unspecified.
433
434The "precision" is the number of bits used to represent the significand
435of a floating-point number; the corresponding C data type is
436`mpfr_prec_t'.  The precision can be any integer between
437`MPFR_PREC_MIN' and `MPFR_PREC_MAX'. In the current implementation,
438`MPFR_PREC_MIN' is equal to 2.
439
440   Warning! MPFR needs to increase the precision internally, in order to
441provide accurate results (and in particular, correct rounding). Do not
442attempt to set the precision to any value near `MPFR_PREC_MAX',
443otherwise MPFR will abort due to an assertion failure. Moreover, you
444may reach some memory limit on your platform, in which case the program
445may abort, crash or have undefined behavior (depending on your C
446implementation).
447
448The "rounding mode" specifies the way to round the result of a
449floating-point operation, in case the exact result can not be
450represented exactly in the destination significand; the corresponding C
451data type is `mpfr_rnd_t'.
452
453
454File: mpfr.info,  Node: MPFR Variable Conventions,  Next: Rounding Modes,  Prev: Nomenclature and Types,  Up: MPFR Basics
455
4564.3 MPFR Variable Conventions
457=============================
458
459Before you can assign to an MPFR variable, you need to initialize it by
460calling one of the special initialization functions.  When you're done
461with a variable, you need to clear it out, using one of the functions
462for that purpose.  A variable should only be initialized once, or at
463least cleared out between each initialization.  After a variable has
464been initialized, it may be assigned to any number of times.  For
465efficiency reasons, avoid to initialize and clear out a variable in
466loops.  Instead, initialize it before entering the loop, and clear it
467out after the loop has exited.  You do not need to be concerned about
468allocating additional space for MPFR variables, since any variable has
469a significand of fixed size.  Hence unless you change its precision, or
470clear and reinitialize it, a floating-point variable will have the same
471allocated space during all its life.
472
473   As a general rule, all MPFR functions expect output arguments before
474input arguments.  This notation is based on an analogy with the
475assignment operator.  MPFR allows you to use the same variable for both
476input and output in the same expression.  For example, the main
477function for floating-point multiplication, `mpfr_mul', can be used
478like this: `mpfr_mul (x, x, x, rnd)'.  This computes the square of X
479with rounding mode `rnd' and puts the result back in X.
480
481
482File: mpfr.info,  Node: Rounding Modes,  Next: Floating-Point Values on Special Numbers,  Prev: MPFR Variable Conventions,  Up: MPFR Basics
483
4844.4 Rounding Modes
485==================
486
487The following five rounding modes are supported:
488
489   * `MPFR_RNDN': round to nearest (roundTiesToEven in IEEE 754-2008),
490
491   * `MPFR_RNDZ': round toward zero (roundTowardZero in IEEE 754-2008),
492
493   * `MPFR_RNDU': round toward plus infinity (roundTowardPositive in
494     IEEE 754-2008),
495
496   * `MPFR_RNDD': round toward minus infinity (roundTowardNegative in
497     IEEE 754-2008),
498
499   * `MPFR_RNDA': round away from zero.
500
501   The `round to nearest' mode works as in the IEEE 754 standard: in
502case the number to be rounded lies exactly in the middle of two
503representable numbers, it is rounded to the one with the least
504significant bit set to zero.  For example, the number 2.5, which is
505represented by (10.1) in binary, is rounded to (10.0)=2 with a
506precision of two bits, and not to (11.0)=3.  This rule avoids the
507"drift" phenomenon mentioned by Knuth in volume 2 of The Art of
508Computer Programming (Section 4.2.2).
509
510   Most MPFR functions take as first argument the destination variable,
511as second and following arguments the input variables, as last argument
512a rounding mode, and have a return value of type `int', called the
513"ternary value". The value stored in the destination variable is
514correctly rounded, i.e., MPFR behaves as if it computed the result with
515an infinite precision, then rounded it to the precision of this
516variable.  The input variables are regarded as exact (in particular,
517their precision does not affect the result).
518
519   As a consequence, in case of a non-zero real rounded result, the
520error on the result is less or equal to 1/2 ulp (unit in the last
521place) of that result in the rounding to nearest mode, and less than 1
522ulp of that result in the directed rounding modes (a ulp is the weight
523of the least significant represented bit of the result after rounding).
524
525   Unless documented otherwise, functions returning an `int' return a
526ternary value.  If the ternary value is zero, it means that the value
527stored in the destination variable is the exact result of the
528corresponding mathematical function. If the ternary value is positive
529(resp. negative), it means the value stored in the destination variable
530is greater (resp. lower) than the exact result. For example with the
531`MPFR_RNDU' rounding mode, the ternary value is usually positive,
532except when the result is exact, in which case it is zero. In the case
533of an infinite result, it is considered as inexact when it was obtained
534by overflow, and exact otherwise. A NaN result (Not-a-Number) always
535corresponds to an exact return value.  The opposite of a returned
536ternary value is guaranteed to be representable in an `int'.
537
538   Unless documented otherwise, functions returning as result the value
539`1' (or any other value specified in this manual) for special cases
540(like `acos(0)') yield an overflow or an underflow if that value is not
541representable in the current exponent range.
542
543
544File: mpfr.info,  Node: Floating-Point Values on Special Numbers,  Next: Exceptions,  Prev: Rounding Modes,  Up: MPFR Basics
545
5464.5 Floating-Point Values on Special Numbers
547============================================
548
549This section specifies the floating-point values (of type `mpfr_t')
550returned by MPFR functions (where by "returned" we mean here the
551modified value of the destination object, which should not be mixed
552with the ternary return value of type `int' of those functions).  For
553functions returning several values (like `mpfr_sin_cos'), the rules
554apply to each result separately.
555
556   Functions can have one or several input arguments. An input point is
557a mapping from these input arguments to the set of the MPFR numbers.
558When none of its components are NaN, an input point can also be seen as
559a tuple in the extended real numbers (the set of the real numbers with
560both infinities).
561
562   When the input point is in the domain of the mathematical function,
563the result is rounded as described in Section "Rounding Modes" (but see
564below for the specification of the sign of an exact zero). Otherwise
565the general rules from this section apply unless stated otherwise in
566the description of the MPFR function (*note MPFR Interface::).
567
568   When the input point is not in the domain of the mathematical
569function but is in its closure in the extended real numbers and the
570function can be extended by continuity, the result is the obtained
571limit.  Examples: `mpfr_hypot' on (+Inf,0) gives +Inf. But `mpfr_pow'
572cannot be defined on (1,+Inf) using this rule, as one can find
573sequences (X_N,Y_N) such that X_N goes to 1, Y_N goes to +Inf and X_N
574to the Y_N goes to any positive value when N goes to the infinity.
575
576   When the input point is in the closure of the domain of the
577mathematical function and an input argument is +0 (resp. -0), one
578considers the limit when the corresponding argument approaches 0 from
579above (resp. below). If the limit is not defined (e.g., `mpfr_log' on
580-0), the behavior is specified in the description of the MPFR function.
581
582   When the result is equal to 0, its sign is determined by considering
583the limit as if the input point were not in the domain: If one
584approaches 0 from above (resp. below), the result is +0 (resp. -0); for
585example, `mpfr_sin' on +0 gives +0.  In the other cases, the sign is
586specified in the description of the MPFR function; for example
587`mpfr_max' on -0 and +0 gives +0.
588
589   When the input point is not in the closure of the domain of the
590function, the result is NaN. Example: `mpfr_sqrt' on -17 gives NaN.
591
592   When an input argument is NaN, the result is NaN, possibly except
593when a partial function is constant on the finite floating-point
594numbers; such a case is always explicitly specified in *note MPFR
595Interface::.  Example: `mpfr_hypot' on (NaN,0) gives NaN, but
596`mpfr_hypot' on (NaN,+Inf) gives +Inf (as specified in *note Special
597Functions::), since for any finite input X, `mpfr_hypot' on (X,+Inf)
598gives +Inf.
599
600
601File: mpfr.info,  Node: Exceptions,  Next: Memory Handling,  Prev: Floating-Point Values on Special Numbers,  Up: MPFR Basics
602
6034.6 Exceptions
604==============
605
606MPFR supports 6 exception types:
607
608   * Underflow: An underflow occurs when the exact result of a function
609     is a non-zero real number and the result obtained after the
610     rounding, assuming an unbounded exponent range (for the rounding),
611     has an exponent smaller than the minimum value of the current
612     exponent range. (In the round-to-nearest mode, the halfway case is
613     rounded toward zero.)
614
615     Note: This is not the single possible definition of the underflow.
616     MPFR chooses to consider the underflow _after_ rounding. The
617     underflow before rounding can also be defined. For instance,
618     consider a function that has the exact result 7 multiplied by two
619     to the power E-4, where E is the smallest exponent (for a
620     significand between 1/2 and 1), with a 2-bit target precision and
621     rounding toward plus infinity.  The exact result has the exponent
622     E-1. With the underflow before rounding, such a function call
623     would yield an underflow, as E-1 is outside the current exponent
624     range. However, MPFR first considers the rounded result assuming
625     an unbounded exponent range.  The exact result cannot be
626     represented exactly in precision 2, and here, it is rounded to 0.5
627     times 2 to E, which is representable in the current exponent
628     range. As a consequence, this will not yield an underflow in MPFR.
629
630   * Overflow: An overflow occurs when the exact result of a function
631     is a non-zero real number and the result obtained after the
632     rounding, assuming an unbounded exponent range (for the rounding),
633     has an exponent larger than the maximum value of the current
634     exponent range. In the round-to-nearest mode, the result is
635     infinite.  Note: unlike the underflow case, there is only one
636     possible definition of overflow here.
637
638   * Divide-by-zero: An exact infinite result is obtained from finite
639     inputs.
640
641   * NaN: A NaN exception occurs when the result of a function is NaN.
642
643   * Inexact: An inexact exception occurs when the result of a function
644     cannot be represented exactly and must be rounded.
645
646   * Range error: A range exception occurs when a function that does
647     not return a MPFR number (such as comparisons and conversions to
648     an integer) has an invalid result (e.g., an argument is NaN in
649     `mpfr_cmp', or a conversion to an integer cannot be represented in
650     the target type).
651
652
653   MPFR has a global flag for each exception, which can be cleared, set
654or tested by functions described in *note Exception Related Functions::.
655
656   Differences with the ISO C99 standard:
657
658   * In C, only quiet NaNs are specified, and a NaN propagation does not
659     raise an invalid exception. Unless explicitly stated otherwise,
660     MPFR sets the NaN flag whenever a NaN is generated, even when a
661     NaN is propagated (e.g., in NaN + NaN), as if all NaNs were
662     signaling.
663
664   * An invalid exception in C corresponds to either a NaN exception or
665     a range error in MPFR.
666
667
668
669File: mpfr.info,  Node: Memory Handling,  Prev: Exceptions,  Up: MPFR Basics
670
6714.7 Memory Handling
672===================
673
674MPFR functions may create caches, e.g., when computing constants such
675as Pi, either because the user has called a function like
676`mpfr_const_pi' directly or because such a function was called
677internally by the MPFR library itself to compute some other function.
678
679   At any time, the user can free the various caches with
680`mpfr_free_cache'. It is strongly advised to do that before terminating
681a thread, or before exiting when using tools like `valgrind' (to avoid
682memory leaks being reported).
683
684   MPFR internal data such as flags, the exponent range, the default
685precision and rounding mode, and caches (i.e., data that are not
686accessed via parameters) are either global (if MPFR has not been
687compiled as thread safe) or per-thread (thread local storage, TLS).
688The initial values of TLS data after a thread is created entirely
689depend on the compiler and thread implementation (MPFR simply does a
690conventional variable initialization, the variables being declared with
691an implementation-defined TLS specifier).
692
693
694File: mpfr.info,  Node: MPFR Interface,  Next: API Compatibility,  Prev: MPFR Basics,  Up: Top
695
6965 MPFR Interface
697****************
698
699The floating-point functions expect arguments of type `mpfr_t'.
700
701   The MPFR floating-point functions have an interface that is similar
702to the GNU MP functions.  The function prefix for floating-point
703operations is `mpfr_'.
704
705   The user has to specify the precision of each variable.  A
706computation that assigns a variable will take place with the precision
707of the assigned variable; the cost of that computation should not
708depend on the precision of variables used as input (on average).
709
710   The semantics of a calculation in MPFR is specified as follows:
711Compute the requested operation exactly (with "infinite accuracy"), and
712round the result to the precision of the destination variable, with the
713given rounding mode.  The MPFR floating-point functions are intended to
714be a smooth extension of the IEEE 754 arithmetic. The results obtained
715on a given computer are identical to those obtained on a computer with
716a different word size, or with a different compiler or operating system.
717
718   MPFR _does not keep track_ of the accuracy of a computation. This is
719left to the user or to a higher layer (for example the MPFI library for
720interval arithmetic).  As a consequence, if two variables are used to
721store only a few significant bits, and their product is stored in a
722variable with large precision, then MPFR will still compute the result
723with full precision.
724
725   The value of the standard C macro `errno' may be set to non-zero by
726any MPFR function or macro, whether or not there is an error.
727
728* Menu:
729
730* Initialization Functions::
731* Assignment Functions::
732* Combined Initialization and Assignment Functions::
733* Conversion Functions::
734* Basic Arithmetic Functions::
735* Comparison Functions::
736* Special Functions::
737* Input and Output Functions::
738* Formatted Output Functions::
739* Integer Related Functions::
740* Rounding Related Functions::
741* Miscellaneous Functions::
742* Exception Related Functions::
743* Compatibility with MPF::
744* Custom Interface::
745* Internals::
746
747
748File: mpfr.info,  Node: Initialization Functions,  Next: Assignment Functions,  Prev: MPFR Interface,  Up: MPFR Interface
749
7505.1 Initialization Functions
751============================
752
753An `mpfr_t' object must be initialized before storing the first value in
754it.  The functions `mpfr_init' and `mpfr_init2' are used for that
755purpose.
756
757 -- Function: void mpfr_init2 (mpfr_t X, mpfr_prec_t PREC)
758     Initialize X, set its precision to be *exactly* PREC bits and its
759     value to NaN. (Warning: the corresponding MPF function initializes
760     to zero instead.)
761
762     Normally, a variable should be initialized once only or at least
763     be cleared, using `mpfr_clear', between initializations.  To
764     change the precision of a variable which has already been
765     initialized, use `mpfr_set_prec'.  The precision PREC must be an
766     integer between `MPFR_PREC_MIN' and `MPFR_PREC_MAX' (otherwise the
767     behavior is undefined).
768
769 -- Function: void mpfr_inits2 (mpfr_prec_t PREC, mpfr_t X, ...)
770     Initialize all the `mpfr_t' variables of the given variable
771     argument `va_list', set their precision to be *exactly* PREC bits
772     and their value to NaN.  See `mpfr_init2' for more details.  The
773     `va_list' is assumed to be composed only of type `mpfr_t' (or
774     equivalently `mpfr_ptr').  It begins from X, and ends when it
775     encounters a null pointer (whose type must also be `mpfr_ptr').
776
777 -- Function: void mpfr_clear (mpfr_t X)
778     Free the space occupied by the significand of X.  Make sure to
779     call this function for all `mpfr_t' variables when you are done
780     with them.
781
782 -- Function: void mpfr_clears (mpfr_t X, ...)
783     Free the space occupied by all the `mpfr_t' variables of the given
784     `va_list'. See `mpfr_clear' for more details.  The `va_list' is
785     assumed to be composed only of type `mpfr_t' (or equivalently
786     `mpfr_ptr').  It begins from X, and ends when it encounters a null
787     pointer (whose type must also be `mpfr_ptr').
788
789   Here is an example of how to use multiple initialization functions
790(since `NULL' is not necessarily defined in this context, we use
791`(mpfr_ptr) 0' instead, but `(mpfr_ptr) NULL' is also correct).
792
793     {
794       mpfr_t x, y, z, t;
795       mpfr_inits2 (256, x, y, z, t, (mpfr_ptr) 0);
796       ...
797       mpfr_clears (x, y, z, t, (mpfr_ptr) 0);
798     }
799
800 -- Function: void mpfr_init (mpfr_t X)
801     Initialize X, set its precision to the default precision, and set
802     its value to NaN.  The default precision can be changed by a call
803     to `mpfr_set_default_prec'.
804
805     Warning! In a given program, some other libraries might change the
806     default precision and not restore it. Thus it is safer to use
807     `mpfr_init2'.
808
809 -- Function: void mpfr_inits (mpfr_t X, ...)
810     Initialize all the `mpfr_t' variables of the given `va_list', set
811     their precision to the default precision and their value to NaN.
812     See `mpfr_init' for more details.  The `va_list' is assumed to be
813     composed only of type `mpfr_t' (or equivalently `mpfr_ptr').  It
814     begins from X, and ends when it encounters a null pointer (whose
815     type must also be `mpfr_ptr').
816
817     Warning! In a given program, some other libraries might change the
818     default precision and not restore it. Thus it is safer to use
819     `mpfr_inits2'.
820
821 -- Macro: MPFR_DECL_INIT (NAME, PREC)
822     This macro declares NAME as an automatic variable of type `mpfr_t',
823     initializes it and sets its precision to be *exactly* PREC bits
824     and its value to NaN. NAME must be a valid identifier.  You must
825     use this macro in the declaration section.  This macro is much
826     faster than using `mpfr_init2' but has some drawbacks:
827
828        * You *must not* call `mpfr_clear' with variables created with
829          this macro (the storage is allocated at the point of
830          declaration and deallocated when the brace-level is exited).
831
832        * You *cannot* change their precision.
833
834        * You *should not* create variables with huge precision with
835          this macro.
836
837        * Your compiler must support `Non-Constant Initializers'
838          (standard in C++ and ISO C99) and `Token Pasting' (standard
839          in ISO C89). If PREC is not a constant expression, your
840          compiler must support `variable-length automatic arrays'
841          (standard in ISO C99). GCC 2.95.3 and above supports all
842          these features.  If you compile your program with GCC in C89
843          mode and with `-pedantic', you may want to define the
844          `MPFR_USE_EXTENSION' macro to avoid warnings due to the
845          `MPFR_DECL_INIT' implementation.
846
847 -- Function: void mpfr_set_default_prec (mpfr_prec_t PREC)
848     Set the default precision to be *exactly* PREC bits, where PREC
849     can be any integer between `MPFR_PREC_MIN' and `MPFR_PREC_MAX'.
850     The precision of a variable means the number of bits used to store
851     its significand.  All subsequent calls to `mpfr_init' or
852     `mpfr_inits' will use this precision, but previously initialized
853     variables are unaffected.  The default precision is set to 53 bits
854     initially.
855
856     Note: when MPFR is built with the `--enable-thread-safe' configure
857     option, the default precision is local to each thread. *Note
858     Memory Handling::, for more information.
859
860 -- Function: mpfr_prec_t mpfr_get_default_prec (void)
861     Return the current default MPFR precision in bits.  See the
862     documentation of `mpfr_set_default_prec'.
863
864   Here is an example on how to initialize floating-point variables:
865
866     {
867       mpfr_t x, y;
868       mpfr_init (x);                /* use default precision */
869       mpfr_init2 (y, 256);          /* precision _exactly_ 256 bits */
870       ...
871       /* When the program is about to exit, do ... */
872       mpfr_clear (x);
873       mpfr_clear (y);
874       mpfr_free_cache ();           /* free the cache for constants like pi */
875     }
876
877   The following functions are useful for changing the precision during
878a calculation.  A typical use would be for adjusting the precision
879gradually in iterative algorithms like Newton-Raphson, making the
880computation precision closely match the actual accurate part of the
881numbers.
882
883 -- Function: void mpfr_set_prec (mpfr_t X, mpfr_prec_t PREC)
884     Reset the precision of X to be *exactly* PREC bits, and set its
885     value to NaN.  The previous value stored in X is lost. It is
886     equivalent to a call to `mpfr_clear(x)' followed by a call to
887     `mpfr_init2(x, prec)', but more efficient as no allocation is done
888     in case the current allocated space for the significand of X is
889     enough.  The precision PREC can be any integer between
890     `MPFR_PREC_MIN' and `MPFR_PREC_MAX'.  In case you want to keep the
891     previous value stored in X, use `mpfr_prec_round' instead.
892
893 -- Function: mpfr_prec_t mpfr_get_prec (mpfr_t X)
894     Return the precision of X, i.e., the number of bits used to store
895     its significand.
896
897
898File: mpfr.info,  Node: Assignment Functions,  Next: Combined Initialization and Assignment Functions,  Prev: Initialization Functions,  Up: MPFR Interface
899
9005.2 Assignment Functions
901========================
902
903These functions assign new values to already initialized floats (*note
904Initialization Functions::).
905
906 -- Function: int mpfr_set (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
907 -- Function: int mpfr_set_ui (mpfr_t ROP, unsigned long int OP,
908          mpfr_rnd_t RND)
909 -- Function: int mpfr_set_si (mpfr_t ROP, long int OP, mpfr_rnd_t RND)
910 -- Function: int mpfr_set_uj (mpfr_t ROP, uintmax_t OP, mpfr_rnd_t RND)
911 -- Function: int mpfr_set_sj (mpfr_t ROP, intmax_t OP, mpfr_rnd_t RND)
912 -- Function: int mpfr_set_flt (mpfr_t ROP, float OP, mpfr_rnd_t RND)
913 -- Function: int mpfr_set_d (mpfr_t ROP, double OP, mpfr_rnd_t RND)
914 -- Function: int mpfr_set_ld (mpfr_t ROP, long double OP, mpfr_rnd_t
915          RND)
916 -- Function: int mpfr_set_decimal64 (mpfr_t ROP, _Decimal64 OP,
917          mpfr_rnd_t RND)
918 -- Function: int mpfr_set_z (mpfr_t ROP, mpz_t OP, mpfr_rnd_t RND)
919 -- Function: int mpfr_set_q (mpfr_t ROP, mpq_t OP, mpfr_rnd_t RND)
920 -- Function: int mpfr_set_f (mpfr_t ROP, mpf_t OP, mpfr_rnd_t RND)
921     Set the value of ROP from OP, rounded toward the given direction
922     RND.  Note that the input 0 is converted to +0 by `mpfr_set_ui',
923     `mpfr_set_si', `mpfr_set_uj', `mpfr_set_sj', `mpfr_set_z',
924     `mpfr_set_q' and `mpfr_set_f', regardless of the rounding mode.
925     If the system does not support the IEEE 754 standard,
926     `mpfr_set_flt', `mpfr_set_d', `mpfr_set_ld' and
927     `mpfr_set_decimal64' might not preserve the signed zeros.  The
928     `mpfr_set_decimal64' function is built only with the configure
929     option `--enable-decimal-float', which also requires
930     `--with-gmp-build', and when the compiler or system provides the
931     `_Decimal64' data type (recent versions of GCC support this data
932     type); to use `mpfr_set_decimal64', one should define the macro
933     `MPFR_WANT_DECIMAL_FLOATS' before including `mpfr.h'.
934     `mpfr_set_q' might fail if the numerator (or the denominator) can
935     not be represented as a `mpfr_t'.
936
937     Note: If you want to store a floating-point constant to a `mpfr_t',
938     you should use `mpfr_set_str' (or one of the MPFR constant
939     functions, such as `mpfr_const_pi' for Pi) instead of
940     `mpfr_set_flt', `mpfr_set_d', `mpfr_set_ld' or
941     `mpfr_set_decimal64'.  Otherwise the floating-point constant will
942     be first converted into a reduced-precision (e.g., 53-bit) binary
943     (or decimal, for `mpfr_set_decimal64') number before MPFR can work
944     with it.
945
946 -- Function: int mpfr_set_ui_2exp (mpfr_t ROP, unsigned long int OP,
947          mpfr_exp_t E, mpfr_rnd_t RND)
948 -- Function: int mpfr_set_si_2exp (mpfr_t ROP, long int OP, mpfr_exp_t
949          E, mpfr_rnd_t RND)
950 -- Function: int mpfr_set_uj_2exp (mpfr_t ROP, uintmax_t OP, intmax_t
951          E, mpfr_rnd_t RND)
952 -- Function: int mpfr_set_sj_2exp (mpfr_t ROP, intmax_t OP, intmax_t
953          E, mpfr_rnd_t RND)
954 -- Function: int mpfr_set_z_2exp (mpfr_t ROP, mpz_t OP, mpfr_exp_t E,
955          mpfr_rnd_t RND)
956     Set the value of ROP from OP multiplied by two to the power E,
957     rounded toward the given direction RND.  Note that the input 0 is
958     converted to +0.
959
960 -- Function: int mpfr_set_str (mpfr_t ROP, const char *S, int BASE,
961          mpfr_rnd_t RND)
962     Set ROP to the value of the string S in base BASE, rounded in the
963     direction RND.  See the documentation of `mpfr_strtofr' for a
964     detailed description of the valid string formats.  Contrary to
965     `mpfr_strtofr', `mpfr_set_str' requires the _whole_ string to
966     represent a valid floating-point number.
967
968     The meaning of the return value differs from other MPFR functions:
969     it is 0 if the entire string up to the final null character is a
970     valid number in base BASE; otherwise it is -1, and ROP may have
971     changed (users interested in the *note ternary value:: should use
972     `mpfr_strtofr' instead).
973
974     Note: it is preferable to use `mpfr_set_str' if one wants to
975     distinguish between an infinite ROP value coming from an infinite
976     S or from an overflow.
977
978 -- Function: int mpfr_strtofr (mpfr_t ROP, const char *NPTR, char
979          **ENDPTR, int BASE, mpfr_rnd_t RND)
980     Read a floating-point number from a string NPTR in base BASE,
981     rounded in the direction RND; BASE must be either 0 (to detect the
982     base, as described below) or a number from 2 to 62 (otherwise the
983     behavior is undefined). If NPTR starts with valid data, the result
984     is stored in ROP and `*ENDPTR' points to the character just after
985     the valid data (if ENDPTR is not a null pointer); otherwise ROP is
986     set to zero (for consistency with `strtod') and the value of NPTR
987     is stored in the location referenced by ENDPTR (if ENDPTR is not a
988     null pointer). The usual ternary value is returned.
989
990     Parsing follows the standard C `strtod' function with some
991     extensions.  After optional leading whitespace, one has a subject
992     sequence consisting of an optional sign (`+' or `-'), and either
993     numeric data or special data. The subject sequence is defined as
994     the longest initial subsequence of the input string, starting with
995     the first non-whitespace character, that is of the expected form.
996
997     The form of numeric data is a non-empty sequence of significand
998     digits with an optional decimal point, and an optional exponent
999     consisting of an exponent prefix followed by an optional sign and
1000     a non-empty sequence of decimal digits. A significand digit is
1001     either a decimal digit or a Latin letter (62 possible characters),
1002     with `A' = 10, `B' = 11, ..., `Z' = 35; case is ignored in bases
1003     less or equal to 36, in bases larger than 36, `a' = 36, `b' = 37,
1004     ..., `z' = 61.  The value of a significand digit must be strictly
1005     less than the base.  The decimal point can be either the one
1006     defined by the current locale or the period (the first one is
1007     accepted for consistency with the C standard and the practice, the
1008     second one is accepted to allow the programmer to provide MPFR
1009     numbers from strings in a way that does not depend on the current
1010     locale).  The exponent prefix can be `e' or `E' for bases up to
1011     10, or `@' in any base; it indicates a multiplication by a power
1012     of the base. In bases 2 and 16, the exponent prefix can also be
1013     `p' or `P', in which case the exponent, called _binary exponent_,
1014     indicates a multiplication by a power of 2 instead of the base
1015     (there is a difference only for base 16); in base 16 for example
1016     `1p2' represents 4 whereas `1@2' represents 256. The value of an
1017     exponent is always written in base 10.
1018
1019     If the argument BASE is 0, then the base is automatically detected
1020     as follows. If the significand starts with `0b' or `0B', base 2 is
1021     assumed. If the significand starts with `0x' or `0X', base 16 is
1022     assumed. Otherwise base 10 is assumed.
1023
1024     Note: The exponent (if present) must contain at least a digit.
1025     Otherwise the possible exponent prefix and sign are not part of
1026     the number (which ends with the significand). Similarly, if `0b',
1027     `0B', `0x' or `0X' is not followed by a binary/hexadecimal digit,
1028     then the subject sequence stops at the character `0', thus 0 is
1029     read.
1030
1031     Special data (for infinities and NaN) can be `@inf@' or
1032     `@nan@(n-char-sequence-opt)', and if BASE <= 16, it can also be
1033     `infinity', `inf', `nan' or `nan(n-char-sequence-opt)', all case
1034     insensitive.  A `n-char-sequence-opt' is a possibly empty string
1035     containing only digits, Latin letters and the underscore (0, 1, 2,
1036     ..., 9, a, b, ..., z, A, B, ..., Z, _). Note: one has an optional
1037     sign for all data, even NaN.  For example,
1038     `-@nAn@(This_Is_Not_17)' is a valid representation for NaN in base
1039     17.
1040
1041
1042 -- Function: void mpfr_set_nan (mpfr_t X)
1043 -- Function: void mpfr_set_inf (mpfr_t X, int SIGN)
1044 -- Function: void mpfr_set_zero (mpfr_t X, int SIGN)
1045     Set the variable X to NaN (Not-a-Number), infinity or zero
1046     respectively.  In `mpfr_set_inf' or `mpfr_set_zero', X is set to
1047     plus infinity or plus zero iff SIGN is nonnegative; in
1048     `mpfr_set_nan', the sign bit of the result is unspecified.
1049
1050 -- Function: void mpfr_swap (mpfr_t X, mpfr_t Y)
1051     Swap the values X and Y efficiently. Warning: the precisions are
1052     exchanged too; in case the precisions are different, `mpfr_swap'
1053     is thus not equivalent to three `mpfr_set' calls using a third
1054     auxiliary variable.
1055
1056
1057File: mpfr.info,  Node: Combined Initialization and Assignment Functions,  Next: Conversion Functions,  Prev: Assignment Functions,  Up: MPFR Interface
1058
10595.3 Combined Initialization and Assignment Functions
1060====================================================
1061
1062 -- Macro: int mpfr_init_set (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1063 -- Macro: int mpfr_init_set_ui (mpfr_t ROP, unsigned long int OP,
1064          mpfr_rnd_t RND)
1065 -- Macro: int mpfr_init_set_si (mpfr_t ROP, long int OP, mpfr_rnd_t
1066          RND)
1067 -- Macro: int mpfr_init_set_d (mpfr_t ROP, double OP, mpfr_rnd_t RND)
1068 -- Macro: int mpfr_init_set_ld (mpfr_t ROP, long double OP, mpfr_rnd_t
1069          RND)
1070 -- Macro: int mpfr_init_set_z (mpfr_t ROP, mpz_t OP, mpfr_rnd_t RND)
1071 -- Macro: int mpfr_init_set_q (mpfr_t ROP, mpq_t OP, mpfr_rnd_t RND)
1072 -- Macro: int mpfr_init_set_f (mpfr_t ROP, mpf_t OP, mpfr_rnd_t RND)
1073     Initialize ROP and set its value from OP, rounded in the direction
1074     RND.  The precision of ROP will be taken from the active default
1075     precision, as set by `mpfr_set_default_prec'.
1076
1077 -- Function: int mpfr_init_set_str (mpfr_t X, const char *S, int BASE,
1078          mpfr_rnd_t RND)
1079     Initialize X and set its value from the string S in base BASE,
1080     rounded in the direction RND.  See `mpfr_set_str'.
1081
1082
1083File: mpfr.info,  Node: Conversion Functions,  Next: Basic Arithmetic Functions,  Prev: Combined Initialization and Assignment Functions,  Up: MPFR Interface
1084
10855.4 Conversion Functions
1086========================
1087
1088 -- Function: float mpfr_get_flt (mpfr_t OP, mpfr_rnd_t RND)
1089 -- Function: double mpfr_get_d (mpfr_t OP, mpfr_rnd_t RND)
1090 -- Function: long double mpfr_get_ld (mpfr_t OP, mpfr_rnd_t RND)
1091 -- Function: _Decimal64 mpfr_get_decimal64 (mpfr_t OP, mpfr_rnd_t RND)
1092     Convert OP to a `float' (respectively `double', `long double' or
1093     `_Decimal64'), using the rounding mode RND.  If OP is NaN, some
1094     fixed NaN (either quiet or signaling) or the result of 0.0/0.0 is
1095     returned. If OP is ±Inf, an infinity of the same sign or the
1096     result of ±1.0/0.0 is returned. If OP is zero, these functions
1097     return a zero, trying to preserve its sign, if possible.  The
1098     `mpfr_get_decimal64' function is built only under some conditions:
1099     see the documentation of `mpfr_set_decimal64'.
1100
1101 -- Function: long mpfr_get_si (mpfr_t OP, mpfr_rnd_t RND)
1102 -- Function: unsigned long mpfr_get_ui (mpfr_t OP, mpfr_rnd_t RND)
1103 -- Function: intmax_t mpfr_get_sj (mpfr_t OP, mpfr_rnd_t RND)
1104 -- Function: uintmax_t mpfr_get_uj (mpfr_t OP, mpfr_rnd_t RND)
1105     Convert OP to a `long', an `unsigned long', an `intmax_t' or an
1106     `uintmax_t' (respectively) after rounding it with respect to RND.
1107     If OP is NaN, 0 is returned and the _erange_ flag is set.  If OP
1108     is too big for the return type, the function returns the maximum
1109     or the minimum of the corresponding C type, depending on the
1110     direction of the overflow; the _erange_ flag is set too.  See also
1111     `mpfr_fits_slong_p', `mpfr_fits_ulong_p', `mpfr_fits_intmax_p' and
1112     `mpfr_fits_uintmax_p'.
1113
1114 -- Function: double mpfr_get_d_2exp (long *EXP, mpfr_t OP, mpfr_rnd_t
1115          RND)
1116 -- Function: long double mpfr_get_ld_2exp (long *EXP, mpfr_t OP,
1117          mpfr_rnd_t RND)
1118     Return D and set EXP (formally, the value pointed to by EXP) such
1119     that 0.5<=abs(D)<1 and D times 2 raised to EXP equals OP rounded
1120     to double (resp. long double) precision, using the given rounding
1121     mode.  If OP is zero, then a zero of the same sign (or an unsigned
1122     zero, if the implementation does not have signed zeros) is
1123     returned, and EXP is set to 0.  If OP is NaN or an infinity, then
1124     the corresponding double precision (resp. long-double precision)
1125     value is returned, and EXP is undefined.
1126
1127 -- Function: int mpfr_frexp (mpfr_exp_t *EXP, mpfr_t Y, mpfr_t X,
1128          mpfr_rnd_t RND)
1129     Set EXP (formally, the value pointed to by EXP) and Y such that
1130     0.5<=abs(Y)<1 and Y times 2 raised to EXP equals X rounded to the
1131     precision of Y, using the given rounding mode.  If X is zero, then
1132     Y is set to a zero of the same sign and EXP is set to 0.  If X is
1133     NaN or an infinity, then Y is set to the same value and EXP is
1134     undefined.
1135
1136 -- Function: mpfr_exp_t mpfr_get_z_2exp (mpz_t ROP, mpfr_t OP)
1137     Put the scaled significand of OP (regarded as an integer, with the
1138     precision of OP) into ROP, and return the exponent EXP (which may
1139     be outside the current exponent range) such that OP exactly equals
1140     ROP times 2 raised to the power EXP.  If OP is zero, the minimal
1141     exponent `emin' is returned.  If OP is NaN or an infinity, the
1142     _erange_ flag is set, ROP is set to 0, and the the minimal
1143     exponent `emin' is returned.  The returned exponent may be less
1144     than the minimal exponent `emin' of MPFR numbers in the current
1145     exponent range; in case the exponent is not representable in the
1146     `mpfr_exp_t' type, the _erange_ flag is set and the minimal value
1147     of the `mpfr_exp_t' type is returned.
1148
1149 -- Function: int mpfr_get_z (mpz_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1150     Convert OP to a `mpz_t', after rounding it with respect to RND. If
1151     OP is NaN or an infinity, the _erange_ flag is set, ROP is set to
1152     0, and 0 is returned.
1153
1154 -- Function: int mpfr_get_f (mpf_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1155     Convert OP to a `mpf_t', after rounding it with respect to RND.
1156     The _erange_ flag is set if OP is NaN or an infinity, which do not
1157     exist in MPF.  If OP is NaN, then ROP is undefined.  If OP is an
1158     +Inf (resp. -Inf), then ROP is set to the maximum (resp. minimum)
1159     value in the precision of the MPF number; if a future MPF version
1160     supports infinities, this behavior will be considered incorrect
1161     and will change (portable programs should assume that ROP is set
1162     either to this finite number or to an infinite number).  Note that
1163     since MPFR currently has the same exponent type as MPF (but not
1164     with the same radix), the range of values is much larger in MPF
1165     than in MPFR, so that an overflow or underflow is not possible.
1166
1167 -- Function: char * mpfr_get_str (char *STR, mpfr_exp_t *EXPPTR, int
1168          B, size_t N, mpfr_t OP, mpfr_rnd_t RND)
1169     Convert OP to a string of digits in base B, with rounding in the
1170     direction RND, where N is either zero (see below) or the number of
1171     significant digits output in the string; in the latter case, N
1172     must be greater or equal to 2. The base may vary from 2 to 62.  If
1173     the input number is an ordinary number, the exponent is written
1174     through the pointer EXPPTR (for input 0, the current minimal
1175     exponent is written).
1176
1177     The generated string is a fraction, with an implicit radix point
1178     immediately to the left of the first digit.  For example, the
1179     number -3.1416 would be returned as "-31416" in the string and 1
1180     written at EXPPTR.  If RND is to nearest, and OP is exactly in the
1181     middle of two consecutive possible outputs, the one with an even
1182     significand is chosen, where both significands are considered with
1183     the exponent of OP.  Note that for an odd base, this may not
1184     correspond to an even last digit: for example with 2 digits in
1185     base 7, (14) and a half is rounded to (15) which is 12 in decimal,
1186     (16) and a half is rounded to (20) which is 14 in decimal, and
1187     (26) and a half is rounded to (26) which is 20 in decimal.
1188
1189     If N is zero, the number of digits of the significand is chosen
1190     large enough so that re-reading the printed value with the same
1191     precision, assuming both output and input use rounding to nearest,
1192     will recover the original value of OP.  More precisely, in most
1193     cases, the chosen precision of STR is the minimal precision m
1194     depending only on P = PREC(OP) and B that satisfies the above
1195     property, i.e., m = 1 + ceil(P*log(2)/log(B)), with P replaced by
1196     P-1 if B is a power of 2, but in some very rare cases, it might be
1197     m+1 (the smallest case for bases up to 62 is when P equals
1198     186564318007 for bases 7 and 49).
1199
1200     If STR is a null pointer, space for the significand is allocated
1201     using the current allocation function, and a pointer to the string
1202     is returned.  To free the returned string, you must use
1203     `mpfr_free_str'.
1204
1205     If STR is not a null pointer, it should point to a block of storage
1206     large enough for the significand, i.e., at least `max(N + 2, 7)'.
1207     The extra two bytes are for a possible minus sign, and for the
1208     terminating null character, and the value 7 accounts for `-@Inf@'
1209     plus the terminating null character.
1210
1211     A pointer to the string is returned, unless there is an error, in
1212     which case a null pointer is returned.
1213
1214 -- Function: void mpfr_free_str (char *STR)
1215     Free a string allocated by `mpfr_get_str' using the current
1216     unallocation function.  The block is assumed to be `strlen(STR)+1'
1217     bytes.  For more information about how it is done: *note Custom
1218     Allocation: (gmp.info)Custom Allocation.
1219
1220 -- Function: int mpfr_fits_ulong_p (mpfr_t OP, mpfr_rnd_t RND)
1221 -- Function: int mpfr_fits_slong_p (mpfr_t OP, mpfr_rnd_t RND)
1222 -- Function: int mpfr_fits_uint_p (mpfr_t OP, mpfr_rnd_t RND)
1223 -- Function: int mpfr_fits_sint_p (mpfr_t OP, mpfr_rnd_t RND)
1224 -- Function: int mpfr_fits_ushort_p (mpfr_t OP, mpfr_rnd_t RND)
1225 -- Function: int mpfr_fits_sshort_p (mpfr_t OP, mpfr_rnd_t RND)
1226 -- Function: int mpfr_fits_uintmax_p (mpfr_t OP, mpfr_rnd_t RND)
1227 -- Function: int mpfr_fits_intmax_p (mpfr_t OP, mpfr_rnd_t RND)
1228     Return non-zero if OP would fit in the respective C data type,
1229     respectively `unsigned long', `long', `unsigned int', `int',
1230     `unsigned short', `short', `uintmax_t', `intmax_t', when rounded
1231     to an integer in the direction RND.
1232
1233
1234File: mpfr.info,  Node: Basic Arithmetic Functions,  Next: Comparison Functions,  Prev: Conversion Functions,  Up: MPFR Interface
1235
12365.5 Basic Arithmetic Functions
1237==============================
1238
1239 -- Function: int mpfr_add (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
1240          mpfr_rnd_t RND)
1241 -- Function: int mpfr_add_ui (mpfr_t ROP, mpfr_t OP1, unsigned long
1242          int OP2, mpfr_rnd_t RND)
1243 -- Function: int mpfr_add_si (mpfr_t ROP, mpfr_t OP1, long int OP2,
1244          mpfr_rnd_t RND)
1245 -- Function: int mpfr_add_d (mpfr_t ROP, mpfr_t OP1, double OP2,
1246          mpfr_rnd_t RND)
1247 -- Function: int mpfr_add_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2,
1248          mpfr_rnd_t RND)
1249 -- Function: int mpfr_add_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
1250          mpfr_rnd_t RND)
1251     Set ROP to OP1 + OP2 rounded in the direction RND. For types
1252     having no signed zero, it is considered unsigned (i.e., (+0) + 0 =
1253     (+0) and (-0) + 0 = (-0)).  The `mpfr_add_d' function assumes that
1254     the radix of the `double' type is a power of 2, with a precision
1255     at most that declared by the C implementation (macro
1256     `IEEE_DBL_MANT_DIG', and if not defined 53 bits).
1257
1258 -- Function: int mpfr_sub (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
1259          mpfr_rnd_t RND)
1260 -- Function: int mpfr_ui_sub (mpfr_t ROP, unsigned long int OP1,
1261          mpfr_t OP2, mpfr_rnd_t RND)
1262 -- Function: int mpfr_sub_ui (mpfr_t ROP, mpfr_t OP1, unsigned long
1263          int OP2, mpfr_rnd_t RND)
1264 -- Function: int mpfr_si_sub (mpfr_t ROP, long int OP1, mpfr_t OP2,
1265          mpfr_rnd_t RND)
1266 -- Function: int mpfr_sub_si (mpfr_t ROP, mpfr_t OP1, long int OP2,
1267          mpfr_rnd_t RND)
1268 -- Function: int mpfr_d_sub (mpfr_t ROP, double OP1, mpfr_t OP2,
1269          mpfr_rnd_t RND)
1270 -- Function: int mpfr_sub_d (mpfr_t ROP, mpfr_t OP1, double OP2,
1271          mpfr_rnd_t RND)
1272 -- Function: int mpfr_z_sub (mpfr_t ROP, mpz_t OP1, mpfr_t OP2,
1273          mpfr_rnd_t RND)
1274 -- Function: int mpfr_sub_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2,
1275          mpfr_rnd_t RND)
1276 -- Function: int mpfr_sub_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
1277          mpfr_rnd_t RND)
1278     Set ROP to OP1 - OP2 rounded in the direction RND. For types
1279     having no signed zero, it is considered unsigned (i.e., (+0) - 0 =
1280     (+0), (-0) - 0 = (-0), 0 - (+0) = (-0) and 0 - (-0) = (+0)).  The
1281     same restrictions than for `mpfr_add_d' apply to `mpfr_d_sub' and
1282     `mpfr_sub_d'.
1283
1284 -- Function: int mpfr_mul (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
1285          mpfr_rnd_t RND)
1286 -- Function: int mpfr_mul_ui (mpfr_t ROP, mpfr_t OP1, unsigned long
1287          int OP2, mpfr_rnd_t RND)
1288 -- Function: int mpfr_mul_si (mpfr_t ROP, mpfr_t OP1, long int OP2,
1289          mpfr_rnd_t RND)
1290 -- Function: int mpfr_mul_d (mpfr_t ROP, mpfr_t OP1, double OP2,
1291          mpfr_rnd_t RND)
1292 -- Function: int mpfr_mul_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2,
1293          mpfr_rnd_t RND)
1294 -- Function: int mpfr_mul_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
1295          mpfr_rnd_t RND)
1296     Set ROP to OP1 times OP2 rounded in the direction RND.  When a
1297     result is zero, its sign is the product of the signs of the
1298     operands (for types having no signed zero, it is considered
1299     positive).  The same restrictions than for `mpfr_add_d' apply to
1300     `mpfr_mul_d'.
1301
1302 -- Function: int mpfr_sqr (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1303     Set ROP to the square of OP rounded in the direction RND.
1304
1305 -- Function: int mpfr_div (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
1306          mpfr_rnd_t RND)
1307 -- Function: int mpfr_ui_div (mpfr_t ROP, unsigned long int OP1,
1308          mpfr_t OP2, mpfr_rnd_t RND)
1309 -- Function: int mpfr_div_ui (mpfr_t ROP, mpfr_t OP1, unsigned long
1310          int OP2, mpfr_rnd_t RND)
1311 -- Function: int mpfr_si_div (mpfr_t ROP, long int OP1, mpfr_t OP2,
1312          mpfr_rnd_t RND)
1313 -- Function: int mpfr_div_si (mpfr_t ROP, mpfr_t OP1, long int OP2,
1314          mpfr_rnd_t RND)
1315 -- Function: int mpfr_d_div (mpfr_t ROP, double OP1, mpfr_t OP2,
1316          mpfr_rnd_t RND)
1317 -- Function: int mpfr_div_d (mpfr_t ROP, mpfr_t OP1, double OP2,
1318          mpfr_rnd_t RND)
1319 -- Function: int mpfr_div_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2,
1320          mpfr_rnd_t RND)
1321 -- Function: int mpfr_div_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
1322          mpfr_rnd_t RND)
1323     Set ROP to OP1/OP2 rounded in the direction RND.  When a result is
1324     zero, its sign is the product of the signs of the operands (for
1325     types having no signed zero, it is considered positive).  The same
1326     restrictions than for `mpfr_add_d' apply to `mpfr_d_div' and
1327     `mpfr_div_d'.
1328
1329 -- Function: int mpfr_sqrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1330 -- Function: int mpfr_sqrt_ui (mpfr_t ROP, unsigned long int OP,
1331          mpfr_rnd_t RND)
1332     Set ROP to the square root of OP rounded in the direction RND (set
1333     ROP to -0 if OP is -0, to be consistent with the IEEE 754
1334     standard).  Set ROP to NaN if OP is negative.
1335
1336 -- Function: int mpfr_rec_sqrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1337     Set ROP to the reciprocal square root of OP rounded in the
1338     direction RND. Set ROP to +Inf if OP is ±0, +0 if OP is +Inf, and
1339     NaN if OP is negative.
1340
1341 -- Function: int mpfr_cbrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1342 -- Function: int mpfr_root (mpfr_t ROP, mpfr_t OP, unsigned long int
1343          K, mpfr_rnd_t RND)
1344     Set ROP to the cubic root (resp. the Kth root) of OP rounded in
1345     the direction RND.  For K odd (resp. even) and OP negative
1346     (including -Inf), set ROP to a negative number (resp. NaN).  The
1347     Kth root of -0 is defined to be -0, whatever the parity of K.
1348
1349 -- Function: int mpfr_pow (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
1350          mpfr_rnd_t RND)
1351 -- Function: int mpfr_pow_ui (mpfr_t ROP, mpfr_t OP1, unsigned long
1352          int OP2, mpfr_rnd_t RND)
1353 -- Function: int mpfr_pow_si (mpfr_t ROP, mpfr_t OP1, long int OP2,
1354          mpfr_rnd_t RND)
1355 -- Function: int mpfr_pow_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2,
1356          mpfr_rnd_t RND)
1357 -- Function: int mpfr_ui_pow_ui (mpfr_t ROP, unsigned long int OP1,
1358          unsigned long int OP2, mpfr_rnd_t RND)
1359 -- Function: int mpfr_ui_pow (mpfr_t ROP, unsigned long int OP1,
1360          mpfr_t OP2, mpfr_rnd_t RND)
1361     Set ROP to OP1 raised to OP2, rounded in the direction RND.
1362     Special values are handled as described in the ISO C99 and IEEE
1363     754-2008 standards for the `pow' function:
1364        * `pow(±0, Y)' returns plus or minus infinity for Y a negative
1365          odd integer.
1366
1367        * `pow(±0, Y)' returns plus infinity for Y negative and not an
1368          odd integer.
1369
1370        * `pow(±0, Y)' returns plus or minus zero for Y a positive odd
1371          integer.
1372
1373        * `pow(±0, Y)' returns plus zero for Y positive and not an odd
1374          integer.
1375
1376        * `pow(-1, ±Inf)' returns 1.
1377
1378        * `pow(+1, Y)' returns 1 for any Y, even a NaN.
1379
1380        * `pow(X, ±0)' returns 1 for any X, even a NaN.
1381
1382        * `pow(X, Y)' returns NaN for finite negative X and finite
1383          non-integer Y.
1384
1385        * `pow(X, -Inf)' returns plus infinity for 0 < abs(x) < 1, and
1386          plus zero for abs(x) > 1.
1387
1388        * `pow(X, +Inf)' returns plus zero for 0 < abs(x) < 1, and plus
1389          infinity for abs(x) > 1.
1390
1391        * `pow(-Inf, Y)' returns minus zero for Y a negative odd
1392          integer.
1393
1394        * `pow(-Inf, Y)' returns plus zero for Y negative and not an
1395          odd integer.
1396
1397        * `pow(-Inf, Y)' returns minus infinity for Y a positive odd
1398          integer.
1399
1400        * `pow(-Inf, Y)' returns plus infinity for Y positive and not
1401          an odd integer.
1402
1403        * `pow(+Inf, Y)' returns plus zero for Y negative, and plus
1404          infinity for Y positive.
1405
1406 -- Function: int mpfr_neg (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1407 -- Function: int mpfr_abs (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1408     Set ROP to -OP and the absolute value of OP respectively, rounded
1409     in the direction RND.  Just changes or adjusts the sign if ROP and
1410     OP are the same variable, otherwise a rounding might occur if the
1411     precision of ROP is less than that of OP.
1412
1413 -- Function: int mpfr_dim (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
1414          mpfr_rnd_t RND)
1415     Set ROP to the positive difference of OP1 and OP2, i.e., OP1 - OP2
1416     rounded in the direction RND if OP1 > OP2, +0 if OP1 <= OP2, and
1417     NaN if OP1 or OP2 is NaN.
1418
1419 -- Function: int mpfr_mul_2ui (mpfr_t ROP, mpfr_t OP1, unsigned long
1420          int OP2, mpfr_rnd_t RND)
1421 -- Function: int mpfr_mul_2si (mpfr_t ROP, mpfr_t OP1, long int OP2,
1422          mpfr_rnd_t RND)
1423     Set ROP to OP1 times 2 raised to OP2 rounded in the direction RND.
1424     Just increases the exponent by OP2 when ROP and OP1 are identical.
1425
1426 -- Function: int mpfr_div_2ui (mpfr_t ROP, mpfr_t OP1, unsigned long
1427          int OP2, mpfr_rnd_t RND)
1428 -- Function: int mpfr_div_2si (mpfr_t ROP, mpfr_t OP1, long int OP2,
1429          mpfr_rnd_t RND)
1430     Set ROP to OP1 divided by 2 raised to OP2 rounded in the direction
1431     RND. Just decreases the exponent by OP2 when ROP and OP1 are
1432     identical.
1433
1434
1435File: mpfr.info,  Node: Comparison Functions,  Next: Special Functions,  Prev: Basic Arithmetic Functions,  Up: MPFR Interface
1436
14375.6 Comparison Functions
1438========================
1439
1440 -- Function: int mpfr_cmp (mpfr_t OP1, mpfr_t OP2)
1441 -- Function: int mpfr_cmp_ui (mpfr_t OP1, unsigned long int OP2)
1442 -- Function: int mpfr_cmp_si (mpfr_t OP1, long int OP2)
1443 -- Function: int mpfr_cmp_d (mpfr_t OP1, double OP2)
1444 -- Function: int mpfr_cmp_ld (mpfr_t OP1, long double OP2)
1445 -- Function: int mpfr_cmp_z (mpfr_t OP1, mpz_t OP2)
1446 -- Function: int mpfr_cmp_q (mpfr_t OP1, mpq_t OP2)
1447 -- Function: int mpfr_cmp_f (mpfr_t OP1, mpf_t OP2)
1448     Compare OP1 and OP2.  Return a positive value if OP1 > OP2, zero
1449     if OP1 = OP2, and a negative value if OP1 < OP2.  Both OP1 and OP2
1450     are considered to their full own precision, which may differ.  If
1451     one of the operands is NaN, set the _erange_ flag and return zero.
1452
1453     Note: These functions may be useful to distinguish the three
1454     possible cases.  If you need to distinguish two cases only, it is
1455     recommended to use the predicate functions (e.g., `mpfr_equal_p'
1456     for the equality) described below; they behave like the IEEE 754
1457     comparisons, in particular when one or both arguments are NaN. But
1458     only floating-point numbers can be compared (you may need to do a
1459     conversion first).
1460
1461 -- Function: int mpfr_cmp_ui_2exp (mpfr_t OP1, unsigned long int OP2,
1462          mpfr_exp_t E)
1463 -- Function: int mpfr_cmp_si_2exp (mpfr_t OP1, long int OP2,
1464          mpfr_exp_t E)
1465     Compare OP1 and OP2 multiplied by two to the power E. Similar as
1466     above.
1467
1468 -- Function: int mpfr_cmpabs (mpfr_t OP1, mpfr_t OP2)
1469     Compare |OP1| and |OP2|.  Return a positive value if |OP1| >
1470     |OP2|, zero if |OP1| = |OP2|, and a negative value if |OP1| <
1471     |OP2|.  If one of the operands is NaN, set the _erange_ flag and
1472     return zero.
1473
1474 -- Function: int mpfr_nan_p (mpfr_t OP)
1475 -- Function: int mpfr_inf_p (mpfr_t OP)
1476 -- Function: int mpfr_number_p (mpfr_t OP)
1477 -- Function: int mpfr_zero_p (mpfr_t OP)
1478 -- Function: int mpfr_regular_p (mpfr_t OP)
1479     Return non-zero if OP is respectively NaN, an infinity, an ordinary
1480     number (i.e., neither NaN nor an infinity), zero, or a regular
1481     number (i.e., neither NaN, nor an infinity nor zero). Return zero
1482     otherwise.
1483
1484 -- Macro: int mpfr_sgn (mpfr_t OP)
1485     Return a positive value if OP > 0, zero if OP = 0, and a negative
1486     value if OP < 0.  If the operand is NaN, set the _erange_ flag and
1487     return zero.  This is equivalent to `mpfr_cmp_ui (op, 0)', but
1488     more efficient.
1489
1490 -- Function: int mpfr_greater_p (mpfr_t OP1, mpfr_t OP2)
1491 -- Function: int mpfr_greaterequal_p (mpfr_t OP1, mpfr_t OP2)
1492 -- Function: int mpfr_less_p (mpfr_t OP1, mpfr_t OP2)
1493 -- Function: int mpfr_lessequal_p (mpfr_t OP1, mpfr_t OP2)
1494 -- Function: int mpfr_equal_p (mpfr_t OP1, mpfr_t OP2)
1495     Return non-zero if OP1 > OP2, OP1 >= OP2, OP1 < OP2, OP1 <= OP2,
1496     OP1 = OP2 respectively, and zero otherwise.  Those functions
1497     return zero whenever OP1 and/or OP2 is NaN.
1498
1499 -- Function: int mpfr_lessgreater_p (mpfr_t OP1, mpfr_t OP2)
1500     Return non-zero if OP1 < OP2 or OP1 > OP2 (i.e., neither OP1, nor
1501     OP2 is NaN, and OP1 <> OP2), zero otherwise (i.e., OP1 and/or OP2
1502     is NaN, or OP1 = OP2).
1503
1504 -- Function: int mpfr_unordered_p (mpfr_t OP1, mpfr_t OP2)
1505     Return non-zero if OP1 or OP2 is a NaN (i.e., they cannot be
1506     compared), zero otherwise.
1507
1508
1509File: mpfr.info,  Node: Special Functions,  Next: Input and Output Functions,  Prev: Comparison Functions,  Up: MPFR Interface
1510
15115.7 Special Functions
1512=====================
1513
1514All those functions, except explicitly stated (for example
1515`mpfr_sin_cos'), return a *note ternary value::, i.e., zero for an
1516exact return value, a positive value for a return value larger than the
1517exact result, and a negative value otherwise.
1518
1519   Important note: in some domains, computing special functions (either
1520with correct or incorrect rounding) is expensive, even for small
1521precision, for example the trigonometric and Bessel functions for large
1522argument.
1523
1524 -- Function: int mpfr_log (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1525 -- Function: int mpfr_log2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1526 -- Function: int mpfr_log10 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1527     Set ROP to the natural logarithm of OP, log2(OP) or log10(OP),
1528     respectively, rounded in the direction RND.  Set ROP to -Inf if OP
1529     is -0 (i.e., the sign of the zero has no influence on the result).
1530
1531 -- Function: int mpfr_exp (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1532 -- Function: int mpfr_exp2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1533 -- Function: int mpfr_exp10 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1534     Set ROP to the exponential of OP,  to 2 power of OP or to 10 power
1535     of OP, respectively, rounded in the direction RND.
1536
1537 -- Function: int mpfr_cos (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1538 -- Function: int mpfr_sin (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1539 -- Function: int mpfr_tan (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1540     Set ROP to the cosine of OP, sine of OP, tangent of OP, rounded in
1541     the direction RND.
1542
1543 -- Function: int mpfr_sin_cos (mpfr_t SOP, mpfr_t COP, mpfr_t OP,
1544          mpfr_rnd_t RND)
1545     Set simultaneously SOP to the sine of OP and COP to the cosine of
1546     OP, rounded in the direction RND with the corresponding precisions
1547     of SOP and COP, which must be different variables.  Return 0 iff
1548     both results are exact, more precisely it returns s+4c where s=0
1549     if SOP is exact, s=1 if SOP is larger than the sine of OP, s=2 if
1550     SOP is smaller than the sine of OP, and similarly for c and the
1551     cosine of OP.
1552
1553 -- Function: int mpfr_sec (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1554 -- Function: int mpfr_csc (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1555 -- Function: int mpfr_cot (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1556     Set ROP to the secant of OP, cosecant of OP, cotangent of OP,
1557     rounded in the direction RND.
1558
1559 -- Function: int mpfr_acos (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1560 -- Function: int mpfr_asin (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1561 -- Function: int mpfr_atan (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1562     Set ROP to the arc-cosine, arc-sine or arc-tangent of OP, rounded
1563     in the direction RND.  Note that since `acos(-1)' returns the
1564     floating-point number closest to Pi according to the given
1565     rounding mode, this number might not be in the output range 0 <=
1566     ROP < \pi of the arc-cosine function; still, the result lies in
1567     the image of the output range by the rounding function.  The same
1568     holds for `asin(-1)', `asin(1)', `atan(-Inf)', `atan(+Inf)' or for
1569     `atan(op)' with large OP and small precision of ROP.
1570
1571 -- Function: int mpfr_atan2 (mpfr_t ROP, mpfr_t Y, mpfr_t X,
1572          mpfr_rnd_t RND)
1573     Set ROP to the arc-tangent2 of Y and X, rounded in the direction
1574     RND: if `x > 0', `atan2(y, x) = atan (y/x)'; if `x < 0', `atan2(y,
1575     x) = sign(y)*(Pi - atan (abs(y/x)))', thus a number from -Pi to Pi.
1576     As for `atan', in case the exact mathematical result is +Pi or -Pi,
1577     its rounded result might be outside the function output range.
1578
1579     `atan2(y, 0)' does not raise any floating-point exception.
1580     Special values are handled as described in the ISO C99 and IEEE
1581     754-2008 standards for the `atan2' function:
1582        * `atan2(+0, -0)' returns +Pi.
1583
1584        * `atan2(-0, -0)' returns -Pi.
1585
1586        * `atan2(+0, +0)' returns +0.
1587
1588        * `atan2(-0, +0)' returns -0.
1589
1590        * `atan2(+0, x)' returns +Pi for x < 0.
1591
1592        * `atan2(-0, x)' returns -Pi for x < 0.
1593
1594        * `atan2(+0, x)' returns +0 for x > 0.
1595
1596        * `atan2(-0, x)' returns -0 for x > 0.
1597
1598        * `atan2(y, 0)' returns -Pi/2 for y < 0.
1599
1600        * `atan2(y, 0)' returns +Pi/2 for y > 0.
1601
1602        * `atan2(+Inf, -Inf)' returns +3*Pi/4.
1603
1604        * `atan2(-Inf, -Inf)' returns -3*Pi/4.
1605
1606        * `atan2(+Inf, +Inf)' returns +Pi/4.
1607
1608        * `atan2(-Inf, +Inf)' returns -Pi/4.
1609
1610        * `atan2(+Inf, x)' returns +Pi/2 for finite x.
1611
1612        * `atan2(-Inf, x)' returns -Pi/2 for finite x.
1613
1614        * `atan2(y, -Inf)' returns +Pi for finite y > 0.
1615
1616        * `atan2(y, -Inf)' returns -Pi for finite y < 0.
1617
1618        * `atan2(y, +Inf)' returns +0 for finite y > 0.
1619
1620        * `atan2(y, +Inf)' returns -0 for finite y < 0.
1621
1622 -- Function: int mpfr_cosh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1623 -- Function: int mpfr_sinh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1624 -- Function: int mpfr_tanh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1625     Set ROP to the hyperbolic cosine, sine or tangent of OP, rounded
1626     in the direction RND.
1627
1628 -- Function: int mpfr_sinh_cosh (mpfr_t SOP, mpfr_t COP, mpfr_t OP,
1629          mpfr_rnd_t RND)
1630     Set simultaneously SOP to the hyperbolic sine of OP and COP to the
1631     hyperbolic cosine of OP, rounded in the direction RND with the
1632     corresponding precision of SOP and COP, which must be different
1633     variables.  Return 0 iff both results are exact (see
1634     `mpfr_sin_cos' for a more detailed description of the return
1635     value).
1636
1637 -- Function: int mpfr_sech (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1638 -- Function: int mpfr_csch (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1639 -- Function: int mpfr_coth (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1640     Set ROP to the hyperbolic secant of OP, cosecant of OP, cotangent
1641     of OP, rounded in the direction RND.
1642
1643 -- Function: int mpfr_acosh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1644 -- Function: int mpfr_asinh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1645 -- Function: int mpfr_atanh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1646     Set ROP to the inverse hyperbolic cosine, sine or tangent of OP,
1647     rounded in the direction RND.
1648
1649 -- Function: int mpfr_fac_ui (mpfr_t ROP, unsigned long int OP,
1650          mpfr_rnd_t RND)
1651     Set ROP to the factorial of OP, rounded in the direction RND.
1652
1653 -- Function: int mpfr_log1p (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1654     Set ROP to the logarithm of one plus OP, rounded in the direction
1655     RND.
1656
1657 -- Function: int mpfr_expm1 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1658     Set ROP to the exponential of OP followed by a subtraction by one,
1659     rounded in the direction RND.
1660
1661 -- Function: int mpfr_eint (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1662     Set ROP to the exponential integral of OP, rounded in the
1663     direction RND.  For positive OP, the exponential integral is the
1664     sum of Euler's constant, of the logarithm of OP, and of the sum
1665     for k from 1 to infinity of OP to the power k, divided by k and
1666     factorial(k).  For negative OP, ROP is set to NaN (this definition
1667     for negative argument follows formula 5.1.2 from the Handbook of
1668     Mathematical Functions from Abramowitz and Stegun, a future
1669     version might use another definition).
1670
1671 -- Function: int mpfr_li2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1672     Set ROP to real part of the dilogarithm of OP, rounded in the
1673     direction RND. MPFR defines the dilogarithm function as the
1674     integral of -log(1-t)/t from 0 to OP.
1675
1676 -- Function: int mpfr_gamma (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1677     Set ROP to the value of the Gamma function on OP, rounded in the
1678     direction RND. When OP is a negative integer, ROP is set to NaN.
1679
1680 -- Function: int mpfr_lngamma (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1681     Set ROP to the value of the logarithm of the Gamma function on OP,
1682     rounded in the direction RND.  When -2K-1 <= OP <= -2K, K being a
1683     non-negative integer, ROP is set to NaN.  See also `mpfr_lgamma'.
1684
1685 -- Function: int mpfr_lgamma (mpfr_t ROP, int *SIGNP, mpfr_t OP,
1686          mpfr_rnd_t RND)
1687     Set ROP to the value of the logarithm of the absolute value of the
1688     Gamma function on OP, rounded in the direction RND. The sign (1 or
1689     -1) of Gamma(OP) is returned in the object pointed to by SIGNP.
1690     When OP is an infinity or a non-positive integer, set ROP to +Inf.
1691     When OP is NaN, -Inf or a negative integer, *SIGNP is undefined,
1692     and when OP is ±0, *SIGNP is the sign of the zero.
1693
1694 -- Function: int mpfr_digamma (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1695     Set ROP to the value of the Digamma (sometimes also called Psi)
1696     function on OP, rounded in the direction RND.  When OP is a
1697     negative integer, set ROP to NaN.
1698
1699 -- Function: int mpfr_zeta (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1700 -- Function: int mpfr_zeta_ui (mpfr_t ROP, unsigned long OP,
1701          mpfr_rnd_t RND)
1702     Set ROP to the value of the Riemann Zeta function on OP, rounded
1703     in the direction RND.
1704
1705 -- Function: int mpfr_erf (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1706 -- Function: int mpfr_erfc (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1707     Set ROP to the value of the error function on OP (resp. the
1708     complementary error function on OP) rounded in the direction RND.
1709
1710 -- Function: int mpfr_j0 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1711 -- Function: int mpfr_j1 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1712 -- Function: int mpfr_jn (mpfr_t ROP, long N, mpfr_t OP, mpfr_rnd_t
1713          RND)
1714     Set ROP to the value of the first kind Bessel function of order 0,
1715     (resp. 1 and N) on OP, rounded in the direction RND. When OP is
1716     NaN, ROP is always set to NaN. When OP is plus or minus Infinity,
1717     ROP is set to +0. When OP is zero, and N is not zero, ROP is set
1718     to +0 or -0 depending on the parity and sign of N, and the sign of
1719     OP.
1720
1721 -- Function: int mpfr_y0 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1722 -- Function: int mpfr_y1 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
1723 -- Function: int mpfr_yn (mpfr_t ROP, long N, mpfr_t OP, mpfr_rnd_t
1724          RND)
1725     Set ROP to the value of the second kind Bessel function of order 0
1726     (resp. 1 and N) on OP, rounded in the direction RND. When OP is
1727     NaN or negative, ROP is always set to NaN. When OP is +Inf, ROP is
1728     set to +0. When OP is zero, ROP is set to +Inf or -Inf depending
1729     on the parity and sign of N.
1730
1731 -- Function: int mpfr_fma (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_t
1732          OP3, mpfr_rnd_t RND)
1733 -- Function: int mpfr_fms (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_t
1734          OP3, mpfr_rnd_t RND)
1735     Set ROP to (OP1 times OP2) + OP3 (resp. (OP1 times OP2) - OP3)
1736     rounded in the direction RND.
1737
1738 -- Function: int mpfr_agm (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
1739          mpfr_rnd_t RND)
1740     Set ROP to the arithmetic-geometric mean of OP1 and OP2, rounded
1741     in the direction RND.  The arithmetic-geometric mean is the common
1742     limit of the sequences U_N and V_N, where U_0=OP1, V_0=OP2,
1743     U_(N+1) is the arithmetic mean of U_N and V_N, and V_(N+1) is the
1744     geometric mean of U_N and V_N.  If any operand is negative, set
1745     ROP to NaN.
1746
1747 -- Function: int mpfr_hypot (mpfr_t ROP, mpfr_t X, mpfr_t Y,
1748          mpfr_rnd_t RND)
1749     Set ROP to the Euclidean norm of X and Y, i.e., the square root of
1750     the sum of the squares of X and Y, rounded in the direction RND.
1751     Special values are handled as described in Section F.9.4.3 of the
1752     ISO C99 and IEEE 754-2008 standards: If X or Y is an infinity,
1753     then +Inf is returned in ROP, even if the other number is NaN.
1754
1755 -- Function: int mpfr_ai (mpfr_t ROP, mpfr_t X, mpfr_rnd_t RND)
1756     Set ROP to the value of the Airy function Ai  on X, rounded in the
1757     direction RND.  When X is NaN, ROP is always set to NaN. When X is
1758     +Inf or -Inf, ROP is +0.  The current implementation is not
1759     intended to be used with large arguments.  It works with abs(X)
1760     typically smaller than 500. For larger arguments, other methods
1761     should be used and will be implemented in a future version.
1762
1763 -- Function: int mpfr_const_log2 (mpfr_t ROP, mpfr_rnd_t RND)
1764 -- Function: int mpfr_const_pi (mpfr_t ROP, mpfr_rnd_t RND)
1765 -- Function: int mpfr_const_euler (mpfr_t ROP, mpfr_rnd_t RND)
1766 -- Function: int mpfr_const_catalan (mpfr_t ROP, mpfr_rnd_t RND)
1767     Set ROP to the logarithm of 2, the value of Pi, of Euler's
1768     constant 0.577..., of Catalan's constant 0.915..., respectively,
1769     rounded in the direction RND. These functions cache the computed
1770     values to avoid other calculations if a lower or equal precision
1771     is requested. To free these caches, use `mpfr_free_cache'.
1772
1773 -- Function: void mpfr_free_cache (void)
1774     Free various caches used by MPFR internally, in particular the
1775     caches used by the functions computing constants
1776     (`mpfr_const_log2', `mpfr_const_pi', `mpfr_const_euler' and
1777     `mpfr_const_catalan').  You should call this function before
1778     terminating a thread, even if you did not call these functions
1779     directly (they could have been called internally).
1780
1781 -- Function: int mpfr_sum (mpfr_t ROP, mpfr_ptr const TAB[], unsigned
1782          long int N, mpfr_rnd_t RND)
1783     Set ROP to the sum of all elements of TAB, whose size is N,
1784     rounded in the direction RND. Warning: for efficiency reasons, TAB
1785     is an array of pointers to `mpfr_t', not an array of `mpfr_t'.  If
1786     the returned `int' value is zero, ROP is guaranteed to be the
1787     exact sum; otherwise ROP might be smaller than, equal to, or
1788     larger than the exact sum (in accordance to the rounding mode).
1789     However, `mpfr_sum' does guarantee the result is correctly rounded.
1790
1791
1792File: mpfr.info,  Node: Input and Output Functions,  Next: Formatted Output Functions,  Prev: Special Functions,  Up: MPFR Interface
1793
17945.8 Input and Output Functions
1795==============================
1796
1797This section describes functions that perform input from an input/output
1798stream, and functions that output to an input/output stream.  Passing a
1799null pointer for a `stream' to any of these functions will make them
1800read from `stdin' and write to `stdout', respectively.
1801
1802   When using any of these functions, you must include the `<stdio.h>'
1803standard header before `mpfr.h', to allow `mpfr.h' to define prototypes
1804for these functions.
1805
1806 -- Function: size_t mpfr_out_str (FILE *STREAM, int BASE, size_t N,
1807          mpfr_t OP, mpfr_rnd_t RND)
1808     Output OP on stream STREAM, as a string of digits in base BASE,
1809     rounded in the direction RND.  The base may vary from 2 to 62.
1810     Print N significant digits exactly, or if N is 0, enough digits so
1811     that OP can be read back exactly (see `mpfr_get_str').
1812
1813     In addition to the significant digits, a decimal point (defined by
1814     the current locale) at the right of the first digit and a trailing
1815     exponent in base 10, in the form `eNNN', are printed. If BASE is
1816     greater than 10, `@' will be used instead of `e' as exponent
1817     delimiter.
1818
1819     Return the number of characters written, or if an error occurred,
1820     return 0.
1821
1822 -- Function: size_t mpfr_inp_str (mpfr_t ROP, FILE *STREAM, int BASE,
1823          mpfr_rnd_t RND)
1824     Input a string in base BASE from stream STREAM, rounded in the
1825     direction RND, and put the read float in ROP.
1826
1827     This function reads a word (defined as a sequence of characters
1828     between whitespace) and parses it using `mpfr_set_str'.  See the
1829     documentation of `mpfr_strtofr' for a detailed description of the
1830     valid string formats.
1831
1832     Return the number of bytes read, or if an error occurred, return 0.
1833
1834
1835File: mpfr.info,  Node: Formatted Output Functions,  Next: Integer Related Functions,  Prev: Input and Output Functions,  Up: MPFR Interface
1836
18375.9 Formatted Output Functions
1838==============================
1839
18405.9.1 Requirements
1841------------------
1842
1843The class of `mpfr_printf' functions provides formatted output in a
1844similar manner as the standard C `printf'. These functions are defined
1845only if your system supports ISO C variadic functions and the
1846corresponding argument access macros.
1847
1848   When using any of these functions, you must include the `<stdio.h>'
1849standard header before `mpfr.h', to allow `mpfr.h' to define prototypes
1850for these functions.
1851
18525.9.2 Format String
1853-------------------
1854
1855The format specification accepted by `mpfr_printf' is an extension of
1856the `printf' one. The conversion specification is of the form:
1857     % [flags] [width] [.[precision]] [type] [rounding] conv
1858   `flags', `width', and `precision' have the same meaning as for the
1859standard `printf' (in particular, notice that the `precision' is
1860related to the number of digits displayed in the base chosen by `conv'
1861and not related to the internal precision of the `mpfr_t' variable).
1862`mpfr_printf' accepts the same `type' specifiers as GMP (except the
1863non-standard and deprecated `q', use `ll' instead), namely the length
1864modifiers defined in the C standard:
1865
1866     `h'       `short'
1867     `hh'      `char'
1868     `j'       `intmax_t' or `uintmax_t'
1869     `l'       `long' or `wchar_t'
1870     `ll'      `long long'
1871     `L'       `long double'
1872     `t'       `ptrdiff_t'
1873     `z'       `size_t'
1874
1875   and the `type' specifiers defined in GMP plus `R' and `P' specific
1876to MPFR (the second column in the table below shows the type of the
1877argument read in the argument list and the kind of `conv' specifier to
1878use after the `type' specifier):
1879
1880     `F'       `mpf_t', float conversions
1881     `Q'       `mpq_t', integer conversions
1882     `M'       `mp_limb_t', integer conversions
1883     `N'       `mp_limb_t' array, integer conversions
1884     `Z'       `mpz_t', integer conversions
1885     `P'       `mpfr_prec_t', integer conversions
1886     `R'       `mpfr_t', float conversions
1887
1888   The `type' specifiers have the same restrictions as those mentioned
1889in the GMP documentation: *note Formatted Output Strings:
1890(gmp.info)Formatted Output Strings.  In particular, the `type'
1891specifiers (except `R' and `P') are supported only if they are
1892supported by `gmp_printf' in your GMP build; this implies that the
1893standard specifiers, such as `t', must _also_ be supported by your C
1894library if you want to use them.
1895
1896   The `rounding' field is specific to `mpfr_t' arguments and should
1897not be used with other types.
1898
1899   With conversion specification not involving `P' and `R' types,
1900`mpfr_printf' behaves exactly as `gmp_printf'.
1901
1902   The `P' type specifies that a following `o', `u', `x', or `X'
1903conversion specifier applies to a `mpfr_prec_t' argument.  It is needed
1904because the `mpfr_prec_t' type does not necessarily correspond to an
1905`unsigned int' or any fixed standard type.  The `precision' field
1906specifies the minimum number of digits to appear. The default
1907`precision' is 1.  For example:
1908     mpfr_t x;
1909     mpfr_prec_t p;
1910     mpfr_init (x);
1911     ...
1912     p = mpfr_get_prec (x);
1913     mpfr_printf ("variable x with %Pu bits", p);
1914
1915   The `R' type specifies that a following `a', `A', `b', `e', `E',
1916`f', `F', `g', `G', or `n' conversion specifier applies to a `mpfr_t'
1917argument.  The `R' type can be followed by a `rounding' specifier
1918denoted by one of the following characters:
1919
1920     `U'       round toward plus infinity
1921     `D'       round toward minus infinity
1922     `Y'       round away from zero
1923     `Z'       round toward zero
1924     `N'       round to nearest (with ties to even)
1925     `*'       rounding mode indicated by the
1926               `mpfr_rnd_t' argument just before the
1927               corresponding `mpfr_t' variable.
1928
1929   The default rounding mode is rounding to nearest.  The following
1930three examples are equivalent:
1931     mpfr_t x;
1932     mpfr_init (x);
1933     ...
1934     mpfr_printf ("%.128Rf", x);
1935     mpfr_printf ("%.128RNf", x);
1936     mpfr_printf ("%.128R*f", MPFR_RNDN, x);
1937
1938   Note that the rounding away from zero mode is specified with `Y'
1939because ISO C reserves the `A' specifier for hexadecimal output (see
1940below).
1941
1942   The output `conv' specifiers allowed with `mpfr_t' parameter are:
1943
1944     `a' `A'   hex float, C99 style
1945     `b'       binary output
1946     `e' `E'   scientific format float
1947     `f' `F'   fixed point float
1948     `g' `G'   fixed or scientific float
1949
1950   The conversion specifier `b' which displays the argument in binary is
1951specific to `mpfr_t' arguments and should not be used with other types.
1952Other conversion specifiers have the same meaning as for a `double'
1953argument.
1954
1955   In case of non-decimal output, only the significand is written in the
1956specified base, the exponent is always displayed in decimal.  Special
1957values are always displayed as `nan', `-inf', and `inf' for `a', `b',
1958`e', `f', and `g' specifiers and `NAN', `-INF', and `INF' for `A', `E',
1959`F', and `G' specifiers.
1960
1961   If the `precision' field is not empty, the `mpfr_t' number is
1962rounded to the given precision in the direction specified by the
1963rounding mode.  If the precision is zero with rounding to nearest mode
1964and one of the following `conv' specifiers: `a', `A', `b', `e', `E',
1965tie case is rounded to even when it lies between two consecutive values
1966at the wanted precision which have the same exponent, otherwise, it is
1967rounded away from zero.  For instance, 85 is displayed as "8e+1" and 95
1968is displayed as "1e+2" with the format specification `"%.0RNe"'.  This
1969also applies when the `g' (resp. `G') conversion specifier uses the `e'
1970(resp. `E') style.  If the precision is set to a value greater than the
1971maximum value for an `int', it will be silently reduced down to
1972`INT_MAX'.
1973
1974   If the `precision' field is empty (as in `%Re' or `%.RE') with
1975`conv' specifier `e' and `E', the number is displayed with enough
1976digits so that it can be read back exactly, assuming that the input and
1977output variables have the same precision and that the input and output
1978rounding modes are both rounding to nearest (as for `mpfr_get_str').
1979The default precision for an empty `precision' field with `conv'
1980specifiers `f', `F', `g', and `G' is 6.
1981
19825.9.3 Functions
1983---------------
1984
1985For all the following functions, if the number of characters which
1986ought to be written appears to exceed the maximum limit for an `int',
1987nothing is written in the stream (resp. to `stdout', to BUF, to STR),
1988the function returns -1, sets the _erange_ flag, and (in POSIX system
1989only) `errno' is set to `EOVERFLOW'.
1990
1991 -- Function: int mpfr_fprintf (FILE *STREAM, const char *TEMPLATE, ...)
1992 -- Function: int mpfr_vfprintf (FILE *STREAM, const char *TEMPLATE,
1993          va_list AP)
1994     Print to the stream STREAM the optional arguments under the
1995     control of the template string TEMPLATE.  Return the number of
1996     characters written or a negative value if an error occurred.
1997
1998 -- Function: int mpfr_printf (const char *TEMPLATE, ...)
1999 -- Function: int mpfr_vprintf (const char *TEMPLATE, va_list AP)
2000     Print to `stdout' the optional arguments under the control of the
2001     template string TEMPLATE.  Return the number of characters written
2002     or a negative value if an error occurred.
2003
2004 -- Function: int mpfr_sprintf (char *BUF, const char *TEMPLATE, ...)
2005 -- Function: int mpfr_vsprintf (char *BUF, const char *TEMPLATE,
2006          va_list AP)
2007     Form a null-terminated string corresponding to the optional
2008     arguments under the control of the template string TEMPLATE, and
2009     print it in BUF. No overlap is permitted between BUF and the other
2010     arguments.  Return the number of characters written in the array
2011     BUF _not counting_ the terminating null character or a negative
2012     value if an error occurred.
2013
2014 -- Function: int mpfr_snprintf (char *BUF, size_t N, const char
2015          *TEMPLATE, ...)
2016 -- Function: int mpfr_vsnprintf (char *BUF, size_t N, const char
2017          *TEMPLATE, va_list AP)
2018     Form a null-terminated string corresponding to the optional
2019     arguments under the control of the template string TEMPLATE, and
2020     print it in BUF. If N is zero, nothing is written and BUF may be a
2021     null pointer, otherwise, the N-1 first characters are written in
2022     BUF and the N-th is a null character.  Return the number of
2023     characters that would have been written had N be sufficiently
2024     large, _not counting_ the terminating null character, or a
2025     negative value if an error occurred.
2026
2027 -- Function: int mpfr_asprintf (char **STR, const char *TEMPLATE, ...)
2028 -- Function: int mpfr_vasprintf (char **STR, const char *TEMPLATE,
2029          va_list AP)
2030     Write their output as a null terminated string in a block of
2031     memory allocated using the current allocation function. A pointer
2032     to the block is stored in STR. The block of memory must be freed
2033     using `mpfr_free_str'.  The return value is the number of
2034     characters written in the string, excluding the null-terminator,
2035     or a negative value if an error occurred.
2036
2037
2038File: mpfr.info,  Node: Integer Related Functions,  Next: Rounding Related Functions,  Prev: Formatted Output Functions,  Up: MPFR Interface
2039
20405.10 Integer and Remainder Related Functions
2041============================================
2042
2043 -- Function: int mpfr_rint (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
2044 -- Function: int mpfr_ceil (mpfr_t ROP, mpfr_t OP)
2045 -- Function: int mpfr_floor (mpfr_t ROP, mpfr_t OP)
2046 -- Function: int mpfr_round (mpfr_t ROP, mpfr_t OP)
2047 -- Function: int mpfr_trunc (mpfr_t ROP, mpfr_t OP)
2048     Set ROP to OP rounded to an integer.  `mpfr_rint' rounds to the
2049     nearest representable integer in the given direction RND,
2050     `mpfr_ceil' rounds to the next higher or equal representable
2051     integer, `mpfr_floor' to the next lower or equal representable
2052     integer, `mpfr_round' to the nearest representable integer,
2053     rounding halfway cases away from zero (as in the roundTiesToAway
2054     mode of IEEE 754-2008), and `mpfr_trunc' to the next representable
2055     integer toward zero.
2056
2057     The returned value is zero when the result is exact, positive when
2058     it is greater than the original value of OP, and negative when it
2059     is smaller.  More precisely, the returned value is 0 when OP is an
2060     integer representable in ROP, 1 or -1 when OP is an integer that
2061     is not representable in ROP, 2 or -2 when OP is not an integer.
2062
2063     Note that `mpfr_round' is different from `mpfr_rint' called with
2064     the rounding to nearest mode (where halfway cases are rounded to
2065     an even integer or significand). Note also that no double rounding
2066     is performed; for instance, 10.5 (1010.1 in binary) is rounded by
2067     `mpfr_rint' with rounding to nearest to 12 (1100 in binary) in
2068     2-bit precision, because the two enclosing numbers representable
2069     on two bits are 8 and 12, and the closest is 12.  (If one first
2070     rounded to an integer, one would round 10.5 to 10 with even
2071     rounding, and then 10 would be rounded to 8 again with even
2072     rounding.)
2073
2074 -- Function: int mpfr_rint_ceil (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
2075 -- Function: int mpfr_rint_floor (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t
2076          RND)
2077 -- Function: int mpfr_rint_round (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t
2078          RND)
2079 -- Function: int mpfr_rint_trunc (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t
2080          RND)
2081     Set ROP to OP rounded to an integer.  `mpfr_rint_ceil' rounds to
2082     the next higher or equal integer, `mpfr_rint_floor' to the next
2083     lower or equal integer, `mpfr_rint_round' to the nearest integer,
2084     rounding halfway cases away from zero, and `mpfr_rint_trunc' to
2085     the next integer toward zero.  If the result is not representable,
2086     it is rounded in the direction RND.  The returned value is the
2087     ternary value associated with the considered round-to-integer
2088     function (regarded in the same way as any other mathematical
2089     function).  Contrary to `mpfr_rint', those functions do perform a
2090     double rounding: first OP is rounded to the nearest integer in the
2091     direction given by the function name, then this nearest integer
2092     (if not representable) is rounded in the given direction RND.  For
2093     example, `mpfr_rint_round' with rounding to nearest and a precision
2094     of two bits rounds 6.5 to 7 (halfway cases away from zero), then 7
2095     is rounded to 8 by the round-even rule, despite the fact that 6 is
2096     also representable on two bits, and is closer to 6.5 than 8.
2097
2098 -- Function: int mpfr_frac (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND)
2099     Set ROP to the fractional part of OP, having the same sign as OP,
2100     rounded in the direction RND (unlike in `mpfr_rint', RND affects
2101     only how the exact fractional part is rounded, not how the
2102     fractional part is generated).
2103
2104 -- Function: int mpfr_modf (mpfr_t IOP, mpfr_t FOP, mpfr_t OP,
2105          mpfr_rnd_t RND)
2106     Set simultaneously IOP to the integral part of OP and FOP to the
2107     fractional part of OP, rounded in the direction RND with the
2108     corresponding precision of IOP and FOP (equivalent to
2109     `mpfr_trunc(IOP, OP, RND)' and `mpfr_frac(FOP, OP, RND)'). The
2110     variables IOP and FOP must be different. Return 0 iff both results
2111     are exact (see `mpfr_sin_cos' for a more detailed description of
2112     the return value).
2113
2114 -- Function: int mpfr_fmod (mpfr_t R, mpfr_t X, mpfr_t Y, mpfr_rnd_t
2115          RND)
2116 -- Function: int mpfr_remainder (mpfr_t R, mpfr_t X, mpfr_t Y,
2117          mpfr_rnd_t RND)
2118 -- Function: int mpfr_remquo (mpfr_t R, long* Q, mpfr_t X, mpfr_t Y,
2119          mpfr_rnd_t RND)
2120     Set R to the value of X - NY, rounded according to the direction
2121     RND, where N is the integer quotient of X divided by Y, defined as
2122     follows: N is rounded toward zero for `mpfr_fmod', and to the
2123     nearest integer (ties rounded to even) for `mpfr_remainder' and
2124     `mpfr_remquo'.
2125
2126     Special values are handled as described in Section F.9.7.1 of the
2127     ISO C99 standard: If X is infinite or Y is zero, R is NaN.  If Y
2128     is infinite and X is finite, R is X rounded to the precision of R.
2129     If R is zero, it has the sign of X.  The return value is the
2130     ternary value corresponding to R.
2131
2132     Additionally, `mpfr_remquo' stores the low significant bits from
2133     the quotient N in *Q (more precisely the number of bits in a
2134     `long' minus one), with the sign of X divided by Y (except if
2135     those low bits are all zero, in which case zero is returned).
2136     Note that X may be so large in magnitude relative to Y that an
2137     exact representation of the quotient is not practical.  The
2138     `mpfr_remainder' and `mpfr_remquo' functions are useful for
2139     additive argument reduction.
2140
2141 -- Function: int mpfr_integer_p (mpfr_t OP)
2142     Return non-zero iff OP is an integer.
2143
2144
2145File: mpfr.info,  Node: Rounding Related Functions,  Next: Miscellaneous Functions,  Prev: Integer Related Functions,  Up: MPFR Interface
2146
21475.11 Rounding Related Functions
2148===============================
2149
2150 -- Function: void mpfr_set_default_rounding_mode (mpfr_rnd_t RND)
2151     Set the default rounding mode to RND.  The default rounding mode
2152     is to nearest initially.
2153
2154 -- Function: mpfr_rnd_t mpfr_get_default_rounding_mode (void)
2155     Get the default rounding mode.
2156
2157 -- Function: int mpfr_prec_round (mpfr_t X, mpfr_prec_t PREC,
2158          mpfr_rnd_t RND)
2159     Round X according to RND with precision PREC, which must be an
2160     integer between `MPFR_PREC_MIN' and `MPFR_PREC_MAX' (otherwise the
2161     behavior is undefined).  If PREC is greater or equal to the
2162     precision of X, then new space is allocated for the significand,
2163     and it is filled with zeros.  Otherwise, the significand is
2164     rounded to precision PREC with the given direction. In both cases,
2165     the precision of X is changed to PREC.
2166
2167     Here is an example of how to use `mpfr_prec_round' to implement
2168     Newton's algorithm to compute the inverse of A, assuming X is
2169     already an approximation to N bits:
2170            mpfr_set_prec (t, 2 * n);
2171            mpfr_set (t, a, MPFR_RNDN);         /* round a to 2n bits */
2172            mpfr_mul (t, t, x, MPFR_RNDN);      /* t is correct to 2n bits */
2173            mpfr_ui_sub (t, 1, t, MPFR_RNDN);   /* high n bits cancel with 1 */
2174            mpfr_prec_round (t, n, MPFR_RNDN);  /* t is correct to n bits */
2175            mpfr_mul (t, t, x, MPFR_RNDN);      /* t is correct to n bits */
2176            mpfr_prec_round (x, 2 * n, MPFR_RNDN); /* exact */
2177            mpfr_add (x, x, t, MPFR_RNDN);      /* x is correct to 2n bits */
2178
2179 -- Function: int mpfr_can_round (mpfr_t B, mpfr_exp_t ERR, mpfr_rnd_t
2180          RND1, mpfr_rnd_t RND2, mpfr_prec_t PREC)
2181     Assuming B is an approximation of an unknown number X in the
2182     direction RND1 with error at most two to the power E(b)-ERR where
2183     E(b) is the exponent of B, return a non-zero value if one is able
2184     to round correctly X to precision PREC with the direction RND2,
2185     and 0 otherwise (including for NaN and Inf).  This function *does
2186     not modify* its arguments.
2187
2188     If RND1 is `MPFR_RNDN', then the sign of the error is unknown, but
2189     its absolute value is the same, so that the possible range is
2190     twice as large as with a directed rounding for RND1.
2191
2192     Note: if one wants to also determine the correct *note ternary
2193     value:: when rounding B to precision PREC with rounding mode RND,
2194     a useful trick is the following: if (mpfr_can_round (b, err, MPFR_RNDN, MPFR_RNDZ, prec + (rnd == MPFR_RNDN)))
2195        ...
2196      Indeed, if RND is `MPFR_RNDN', this will check if one can round
2197     to PREC+1 bits with a directed rounding: if so, one can surely
2198     round to nearest to PREC bits, and in addition one can determine
2199     the correct ternary value, which would not be the case when B is
2200     near from a value exactly representable on PREC bits.
2201
2202 -- Function: mpfr_prec_t mpfr_min_prec (mpfr_t X)
2203     Return the minimal number of bits required to store the
2204     significand of X, and 0 for special values, including 0. (Warning:
2205     the returned value can be less than `MPFR_PREC_MIN'.)
2206
2207     The function name is subject to change.
2208
2209 -- Function: const char * mpfr_print_rnd_mode (mpfr_rnd_t RND)
2210     Return a string ("MPFR_RNDD", "MPFR_RNDU", "MPFR_RNDN",
2211     "MPFR_RNDZ", "MPFR_RNDA") corresponding to the rounding mode RND,
2212     or a null pointer if RND is an invalid rounding mode.
2213
2214
2215File: mpfr.info,  Node: Miscellaneous Functions,  Next: Exception Related Functions,  Prev: Rounding Related Functions,  Up: MPFR Interface
2216
22175.12 Miscellaneous Functions
2218============================
2219
2220 -- Function: void mpfr_nexttoward (mpfr_t X, mpfr_t Y)
2221     If X or Y is NaN, set X to NaN. If X and Y are equal, X is
2222     unchanged. Otherwise, if X is different from Y, replace X by the
2223     next floating-point number (with the precision of X and the
2224     current exponent range) in the direction of Y (the infinite values
2225     are seen as the smallest and largest floating-point numbers). If
2226     the result is zero, it keeps the same sign. No underflow or
2227     overflow is generated.
2228
2229 -- Function: void mpfr_nextabove (mpfr_t X)
2230 -- Function: void mpfr_nextbelow (mpfr_t X)
2231     Equivalent to `mpfr_nexttoward' where Y is plus infinity (resp.
2232     minus infinity).
2233
2234 -- Function: int mpfr_min (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
2235          mpfr_rnd_t RND)
2236 -- Function: int mpfr_max (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
2237          mpfr_rnd_t RND)
2238     Set ROP to the minimum (resp. maximum) of OP1 and OP2. If OP1 and
2239     OP2 are both NaN, then ROP is set to NaN. If OP1 or OP2 is NaN,
2240     then ROP is set to the numeric value. If OP1 and OP2 are zeros of
2241     different signs, then ROP is set to -0 (resp. +0).
2242
2243 -- Function: int mpfr_urandomb (mpfr_t ROP, gmp_randstate_t STATE)
2244     Generate a uniformly distributed random float in the interval 0 <=
2245     ROP < 1. More precisely, the number can be seen as a float with a
2246     random non-normalized significand and exponent 0, which is then
2247     normalized (thus if E denotes the exponent after normalization,
2248     then the least -E significant bits of the significand are always
2249     0).
2250
2251     Return 0, unless the exponent is not in the current exponent
2252     range, in which case ROP is set to NaN and a non-zero value is
2253     returned (this should never happen in practice, except in very
2254     specific cases). The second argument is a `gmp_randstate_t'
2255     structure which should be created using the GMP `gmp_randinit'
2256     function (see the GMP manual).
2257
2258     Note: for a given version of MPFR, the returned value of ROP and
2259     the new value of STATE (which controls further random values) do
2260     not depend on the machine word size.
2261
2262 -- Function: int mpfr_urandom (mpfr_t ROP, gmp_randstate_t STATE,
2263          mpfr_rnd_t RND)
2264     Generate a uniformly distributed random float.  The floating-point
2265     number ROP can be seen as if a random real number is generated
2266     according to the continuous uniform distribution on the interval
2267     [0, 1] and then rounded in the direction RND.
2268
2269     The second argument is a `gmp_randstate_t' structure which should
2270     be created using the GMP `gmp_randinit' function (see the GMP
2271     manual).
2272
2273     Note: the note for `mpfr_urandomb' holds too. In addition, the
2274     exponent range and the rounding mode might have a side effect on
2275     the next random state.
2276
2277 -- Function: int mpfr_grandom (mpfr_t ROP1, mpfr_t ROP2,
2278          gmp_randstate_t STATE, mpfr_rnd_t RND)
2279     Generate two random floats according to a standard normal gaussian
2280     distribution. If ROP2 is a null pointer, then only one value is
2281     generated and stored in ROP1.
2282
2283     The floating-point number ROP1 (and ROP2) can be seen as if a
2284     random real number were generated according to the standard normal
2285     gaussian distribution and then rounded in the direction RND.
2286
2287     The third argument is a `gmp_randstate_t' structure, which should
2288     be created using the GMP `gmp_randinit' function (see the GMP
2289     manual).
2290
2291     The combination of the ternary values is returned like with
2292     `mpfr_sin_cos'. If ROP2 is a null pointer, the second ternary
2293     value is assumed to be 0 (note that the encoding of the only
2294     ternary value is not the same as the usual encoding for functions
2295     that return only one result). Otherwise the ternary value of a
2296     random number is always non-zero.
2297
2298     Note: the note for `mpfr_urandomb' holds too. In addition, the
2299     exponent range and the rounding mode might have a side effect on
2300     the next random state.
2301
2302 -- Function: mpfr_exp_t mpfr_get_exp (mpfr_t X)
2303     Return the exponent of X, assuming that X is a non-zero ordinary
2304     number and the significand is considered in [1/2,1). The behavior
2305     for NaN, infinity or zero is undefined.
2306
2307 -- Function: int mpfr_set_exp (mpfr_t X, mpfr_exp_t E)
2308     Set the exponent of X if E is in the current exponent range, and
2309     return 0 (even if X is not a non-zero ordinary number); otherwise,
2310     return a non-zero value.  The significand is assumed to be in
2311     [1/2,1).
2312
2313 -- Function: int mpfr_signbit (mpfr_t OP)
2314     Return a non-zero value iff OP has its sign bit set (i.e., if it is
2315     negative, -0, or a NaN whose representation has its sign bit set).
2316
2317 -- Function: int mpfr_setsign (mpfr_t ROP, mpfr_t OP, int S,
2318          mpfr_rnd_t RND)
2319     Set the value of ROP from OP, rounded toward the given direction
2320     RND, then set (resp. clear) its sign bit if S is non-zero (resp.
2321     zero), even when OP is a NaN.
2322
2323 -- Function: int mpfr_copysign (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
2324          mpfr_rnd_t RND)
2325     Set the value of ROP from OP1, rounded toward the given direction
2326     RND, then set its sign bit to that of OP2 (even when OP1 or OP2 is
2327     a NaN). This function is equivalent to `mpfr_setsign (ROP, OP1,
2328     mpfr_signbit (OP2), RND)'.
2329
2330 -- Function: const char * mpfr_get_version (void)
2331     Return the MPFR version, as a null-terminated string.
2332
2333 -- Macro: MPFR_VERSION
2334 -- Macro: MPFR_VERSION_MAJOR
2335 -- Macro: MPFR_VERSION_MINOR
2336 -- Macro: MPFR_VERSION_PATCHLEVEL
2337 -- Macro: MPFR_VERSION_STRING
2338     `MPFR_VERSION' is the version of MPFR as a preprocessing constant.
2339     `MPFR_VERSION_MAJOR', `MPFR_VERSION_MINOR' and
2340     `MPFR_VERSION_PATCHLEVEL' are respectively the major, minor and
2341     patch level of MPFR version, as preprocessing constants.
2342     `MPFR_VERSION_STRING' is the version (with an optional suffix, used
2343     in development and pre-release versions) as a string constant,
2344     which can be compared to the result of `mpfr_get_version' to check
2345     at run time the header file and library used match:
2346          if (strcmp (mpfr_get_version (), MPFR_VERSION_STRING))
2347            fprintf (stderr, "Warning: header and library do not match\n");
2348     Note: Obtaining different strings is not necessarily an error, as
2349     in general, a program compiled with some old MPFR version can be
2350     dynamically linked with a newer MPFR library version (if allowed
2351     by the library versioning system).
2352
2353 -- Macro: long MPFR_VERSION_NUM (MAJOR, MINOR, PATCHLEVEL)
2354     Create an integer in the same format as used by `MPFR_VERSION'
2355     from the given MAJOR, MINOR and PATCHLEVEL.  Here is an example of
2356     how to check the MPFR version at compile time:
2357          #if (!defined(MPFR_VERSION) || (MPFR_VERSION<MPFR_VERSION_NUM(3,0,0)))
2358          # error "Wrong MPFR version."
2359          #endif
2360
2361 -- Function: const char * mpfr_get_patches (void)
2362     Return a null-terminated string containing the ids of the patches
2363     applied to the MPFR library (contents of the `PATCHES' file),
2364     separated by spaces.  Note: If the program has been compiled with
2365     an older MPFR version and is dynamically linked with a new MPFR
2366     library version, the identifiers of the patches applied to the old
2367     (compile-time) MPFR version are not available (however this
2368     information should not have much interest in general).
2369
2370 -- Function: int mpfr_buildopt_tls_p (void)
2371     Return a non-zero value if MPFR was compiled as thread safe using
2372     compiler-level Thread Local Storage (that is, MPFR was built with
2373     the `--enable-thread-safe' configure option, see `INSTALL' file),
2374     return zero otherwise.
2375
2376 -- Function: int mpfr_buildopt_decimal_p (void)
2377     Return a non-zero value if MPFR was compiled with decimal float
2378     support (that is, MPFR was built with the `--enable-decimal-float'
2379     configure option), return zero otherwise.
2380
2381 -- Function: int mpfr_buildopt_gmpinternals_p (void)
2382     Return a non-zero value if MPFR was compiled with GMP internals
2383     (that is, MPFR was built with either `--with-gmp-build' or
2384     `--enable-gmp-internals' configure option), return zero otherwise.
2385
2386 -- Function: const char * mpfr_buildopt_tune_case (void)
2387     Return a string saying which thresholds file has been used at
2388     compile time.  This file is normally selected from the processor
2389     type.
2390
2391
2392File: mpfr.info,  Node: Exception Related Functions,  Next: Compatibility with MPF,  Prev: Miscellaneous Functions,  Up: MPFR Interface
2393
23945.13 Exception Related Functions
2395================================
2396
2397 -- Function: mpfr_exp_t mpfr_get_emin (void)
2398 -- Function: mpfr_exp_t mpfr_get_emax (void)
2399     Return the (current) smallest and largest exponents allowed for a
2400     floating-point variable. The smallest positive value of a
2401     floating-point variable is one half times 2 raised to the smallest
2402     exponent and the largest value has the form (1 - epsilon) times 2
2403     raised to the largest exponent, where epsilon depends on the
2404     precision of the considered variable.
2405
2406 -- Function: int mpfr_set_emin (mpfr_exp_t EXP)
2407 -- Function: int mpfr_set_emax (mpfr_exp_t EXP)
2408     Set the smallest and largest exponents allowed for a
2409     floating-point variable.  Return a non-zero value when EXP is not
2410     in the range accepted by the implementation (in that case the
2411     smallest or largest exponent is not changed), and zero otherwise.
2412     If the user changes the exponent range, it is her/his
2413     responsibility to check that all current floating-point variables
2414     are in the new allowed range (for example using
2415     `mpfr_check_range'), otherwise the subsequent behavior will be
2416     undefined, in the sense of the ISO C standard.
2417
2418 -- Function: mpfr_exp_t mpfr_get_emin_min (void)
2419 -- Function: mpfr_exp_t mpfr_get_emin_max (void)
2420 -- Function: mpfr_exp_t mpfr_get_emax_min (void)
2421 -- Function: mpfr_exp_t mpfr_get_emax_max (void)
2422     Return the minimum and maximum of the exponents allowed for
2423     `mpfr_set_emin' and `mpfr_set_emax' respectively.  These values
2424     are implementation dependent, thus a program using
2425     `mpfr_set_emax(mpfr_get_emax_max())' or
2426     `mpfr_set_emin(mpfr_get_emin_min())' may not be portable.
2427
2428 -- Function: int mpfr_check_range (mpfr_t X, int T, mpfr_rnd_t RND)
2429     This function assumes that X is the correctly-rounded value of some
2430     real value Y in the direction RND and some extended exponent
2431     range, and that T is the corresponding *note ternary value::.  For
2432     example, one performed `t = mpfr_log (x, u, rnd)', and Y is the
2433     exact logarithm of U.  Thus T is negative if X is smaller than Y,
2434     positive if X is larger than Y, and zero if X equals Y.  This
2435     function modifies X if needed to be in the current range of
2436     acceptable values: It generates an underflow or an overflow if the
2437     exponent of X is outside the current allowed range; the value of T
2438     may be used to avoid a double rounding. This function returns zero
2439     if the new value of X equals the exact one Y, a positive value if
2440     that new value is larger than Y, and a negative value if it is
2441     smaller than Y.  Note that unlike most functions, the new result X
2442     is compared to the (unknown) exact one Y, not the input value X,
2443     i.e., the ternary value is propagated.
2444
2445     Note: If X is an infinity and T is different from zero (i.e., if
2446     the rounded result is an inexact infinity), then the overflow flag
2447     is set. This is useful because `mpfr_check_range' is typically
2448     called (at least in MPFR functions) after restoring the flags that
2449     could have been set due to internal computations.
2450
2451 -- Function: int mpfr_subnormalize (mpfr_t X, int T, mpfr_rnd_t RND)
2452     This function rounds X emulating subnormal number arithmetic: if X
2453     is outside the subnormal exponent range, it just propagates the
2454     *note ternary value:: T; otherwise, it rounds X to precision
2455     `EXP(x)-emin+1' according to rounding mode RND and previous
2456     ternary value T, avoiding double rounding problems.  More
2457     precisely in the subnormal domain, denoting by E the value of
2458     `emin', X is rounded in fixed-point arithmetic to an integer
2459     multiple of two to the power E-1; as a consequence, 1.5 multiplied
2460     by two to the power E-1 when T is zero is rounded to two to the
2461     power E with rounding to nearest.
2462
2463     `PREC(x)' is not modified by this function.  RND and T must be the
2464     rounding mode and the returned ternary value used when computing X
2465     (as in `mpfr_check_range').  The subnormal exponent range is from
2466     `emin' to `emin+PREC(x)-1'.  If the result cannot be represented
2467     in the current exponent range (due to a too small `emax'), the
2468     behavior is undefined.  Note that unlike most functions, the
2469     result is compared to the exact one, not the input value X, i.e.,
2470     the ternary value is propagated.
2471
2472     As usual, if the returned ternary value is non zero, the inexact
2473     flag is set.  Moreover, if a second rounding occurred (because the
2474     input X was in the subnormal range), the underflow flag is set.
2475
2476   This is an example of how to emulate binary double IEEE 754
2477arithmetic (binary64 in IEEE 754-2008) using MPFR:
2478
2479     {
2480       mpfr_t xa, xb; int i; volatile double a, b;
2481
2482       mpfr_set_default_prec (53);
2483       mpfr_set_emin (-1073); mpfr_set_emax (1024);
2484
2485       mpfr_init (xa); mpfr_init (xb);
2486
2487       b = 34.3; mpfr_set_d (xb, b, MPFR_RNDN);
2488       a = 0x1.1235P-1021; mpfr_set_d (xa, a, MPFR_RNDN);
2489
2490       a /= b;
2491       i = mpfr_div (xa, xa, xb, MPFR_RNDN);
2492       i = mpfr_subnormalize (xa, i, MPFR_RNDN); /* new ternary value */
2493
2494       mpfr_clear (xa); mpfr_clear (xb);
2495     }
2496
2497   Warning: this emulates a double IEEE 754 arithmetic with correct
2498rounding in the subnormal range, which may not be the case for your
2499hardware.
2500
2501 -- Function: void mpfr_clear_underflow (void)
2502 -- Function: void mpfr_clear_overflow (void)
2503 -- Function: void mpfr_clear_divby0 (void)
2504 -- Function: void mpfr_clear_nanflag (void)
2505 -- Function: void mpfr_clear_inexflag (void)
2506 -- Function: void mpfr_clear_erangeflag (void)
2507     Clear the underflow, overflow, divide-by-zero, invalid, inexact
2508     and _erange_ flags.
2509
2510 -- Function: void mpfr_set_underflow (void)
2511 -- Function: void mpfr_set_overflow (void)
2512 -- Function: void mpfr_set_divby0 (void)
2513 -- Function: void mpfr_set_nanflag (void)
2514 -- Function: void mpfr_set_inexflag (void)
2515 -- Function: void mpfr_set_erangeflag (void)
2516     Set the underflow, overflow, divide-by-zero, invalid, inexact and
2517     _erange_ flags.
2518
2519 -- Function: void mpfr_clear_flags (void)
2520     Clear all global flags (underflow, overflow, divide-by-zero,
2521     invalid, inexact, _erange_).
2522
2523 -- Function: int mpfr_underflow_p (void)
2524 -- Function: int mpfr_overflow_p (void)
2525 -- Function: int mpfr_divby0_p (void)
2526 -- Function: int mpfr_nanflag_p (void)
2527 -- Function: int mpfr_inexflag_p (void)
2528 -- Function: int mpfr_erangeflag_p (void)
2529     Return the corresponding (underflow, overflow, divide-by-zero,
2530     invalid, inexact, _erange_) flag, which is non-zero iff the flag
2531     is set.
2532
2533
2534File: mpfr.info,  Node: Compatibility with MPF,  Next: Custom Interface,  Prev: Exception Related Functions,  Up: MPFR Interface
2535
25365.14 Compatibility With MPF
2537===========================
2538
2539A header file `mpf2mpfr.h' is included in the distribution of MPFR for
2540compatibility with the GNU MP class MPF.  By inserting the following
2541two lines after the `#include <gmp.h>' line,
2542#include <mpfr.h>
2543#include <mpf2mpfr.h>
2544 any program written for MPF can be compiled directly with MPFR without
2545any changes (except the `gmp_printf' functions will not work for
2546arguments of type `mpfr_t').  All operations are then performed with
2547the default MPFR rounding mode, which can be reset with
2548`mpfr_set_default_rounding_mode'.
2549
2550   Warning: the `mpf_init' and `mpf_init2' functions initialize to
2551zero, whereas the corresponding MPFR functions initialize to NaN: this
2552is useful to detect uninitialized values, but is slightly incompatible
2553with MPF.
2554
2555 -- Function: void mpfr_set_prec_raw (mpfr_t X, mpfr_prec_t PREC)
2556     Reset the precision of X to be *exactly* PREC bits.  The only
2557     difference with `mpfr_set_prec' is that PREC is assumed to be
2558     small enough so that the significand fits into the current
2559     allocated memory space for X. Otherwise the behavior is undefined.
2560
2561 -- Function: int mpfr_eq (mpfr_t OP1, mpfr_t OP2, unsigned long int
2562          OP3)
2563     Return non-zero if OP1 and OP2 are both non-zero ordinary numbers
2564     with the same exponent and the same first OP3 bits, both zero, or
2565     both infinities of the same sign. Return zero otherwise.  This
2566     function is defined for compatibility with MPF, we do not recommend
2567     to use it otherwise.  Do not use it either if you want to know
2568     whether two numbers are close to each other; for instance,
2569     1.011111 and 1.100000 are regarded as different for any value of
2570     OP3 larger than 1.
2571
2572 -- Function: void mpfr_reldiff (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
2573          mpfr_rnd_t RND)
2574     Compute the relative difference between OP1 and OP2 and store the
2575     result in ROP.  This function does not guarantee the correct
2576     rounding on the relative difference; it just computes
2577     |OP1-OP2|/OP1, using the precision of ROP and the rounding mode
2578     RND for all operations.
2579
2580 -- Function: int mpfr_mul_2exp (mpfr_t ROP, mpfr_t OP1, unsigned long
2581          int OP2, mpfr_rnd_t RND)
2582 -- Function: int mpfr_div_2exp (mpfr_t ROP, mpfr_t OP1, unsigned long
2583          int OP2, mpfr_rnd_t RND)
2584     These functions are identical to `mpfr_mul_2ui' and `mpfr_div_2ui'
2585     respectively.  These functions are only kept for compatibility
2586     with MPF, one should prefer `mpfr_mul_2ui' and `mpfr_div_2ui'
2587     otherwise.
2588
2589
2590File: mpfr.info,  Node: Custom Interface,  Next: Internals,  Prev: Compatibility with MPF,  Up: MPFR Interface
2591
25925.15 Custom Interface
2593=====================
2594
2595Some applications use a stack to handle the memory and their objects.
2596However, the MPFR memory design is not well suited for such a thing. So
2597that such applications are able to use MPFR, an auxiliary memory
2598interface has been created: the Custom Interface.
2599
2600   The following interface allows one to use MPFR in two ways:
2601   * Either directly store a floating-point number as a `mpfr_t' on the
2602     stack.
2603
2604   * Either store its own representation on the stack and construct a
2605     new temporary `mpfr_t' each time it is needed.
2606   Nothing has to be done to destroy the floating-point numbers except
2607garbaging the used memory: all the memory management (allocating,
2608destroying, garbaging) is left to the application.
2609
2610   Each function in this interface is also implemented as a macro for
2611efficiency reasons: for example `mpfr_custom_init (s, p)' uses the
2612macro, while `(mpfr_custom_init) (s, p)' uses the function.
2613
2614   Note 1: MPFR functions may still initialize temporary floating-point
2615numbers using `mpfr_init' and similar functions. See Custom Allocation
2616(GNU MP).
2617
2618   Note 2: MPFR functions may use the cached functions (`mpfr_const_pi'
2619for example), even if they are not explicitly called. You have to call
2620`mpfr_free_cache' each time you garbage the memory iff `mpfr_init',
2621through GMP Custom Allocation, allocates its memory on the application
2622stack.
2623
2624 -- Function: size_t mpfr_custom_get_size (mpfr_prec_t PREC)
2625     Return the needed size in bytes to store the significand of a
2626     floating-point number of precision PREC.
2627
2628 -- Function: void mpfr_custom_init (void *SIGNIFICAND, mpfr_prec_t
2629          PREC)
2630     Initialize a significand of precision PREC, where SIGNIFICAND must
2631     be an area of `mpfr_custom_get_size (prec)' bytes at least and be
2632     suitably aligned for an array of `mp_limb_t' (GMP type, *note
2633     Internals::).
2634
2635 -- Function: void mpfr_custom_init_set (mpfr_t X, int KIND, mpfr_exp_t
2636          EXP, mpfr_prec_t PREC, void *SIGNIFICAND)
2637     Perform a dummy initialization of a `mpfr_t' and set it to:
2638        * if `ABS(kind) == MPFR_NAN_KIND', X is set to NaN;
2639
2640        * if `ABS(kind) == MPFR_INF_KIND', X is set to the infinity of
2641          sign `sign(kind)';
2642
2643        * if `ABS(kind) == MPFR_ZERO_KIND', X is set to the zero of
2644          sign `sign(kind)';
2645
2646        * if `ABS(kind) == MPFR_REGULAR_KIND', X is set to a regular
2647          number: `x = sign(kind)*significand*2^exp'.
2648     In all cases, it uses SIGNIFICAND directly for further computing
2649     involving X. It will not allocate anything.  A floating-point
2650     number initialized with this function cannot be resized using
2651     `mpfr_set_prec' or `mpfr_prec_round', or cleared using
2652     `mpfr_clear'!  The SIGNIFICAND must have been initialized with
2653     `mpfr_custom_init' using the same precision PREC.
2654
2655 -- Function: int mpfr_custom_get_kind (mpfr_t X)
2656     Return the current kind of a `mpfr_t' as created by
2657     `mpfr_custom_init_set'.  The behavior of this function for any
2658     `mpfr_t' not initialized with `mpfr_custom_init_set' is undefined.
2659
2660 -- Function: void * mpfr_custom_get_significand (mpfr_t X)
2661     Return a pointer to the significand used by a `mpfr_t' initialized
2662     with `mpfr_custom_init_set'.  The behavior of this function for
2663     any `mpfr_t' not initialized with `mpfr_custom_init_set' is
2664     undefined.
2665
2666 -- Function: mpfr_exp_t mpfr_custom_get_exp (mpfr_t X)
2667     Return the exponent of X, assuming that X is a non-zero ordinary
2668     number. The return value for NaN, Infinity or zero is unspecified
2669     but does not produce any trap.  The behavior of this function for
2670     any `mpfr_t' not initialized with `mpfr_custom_init_set' is
2671     undefined.
2672
2673 -- Function: void mpfr_custom_move (mpfr_t X, void *NEW_POSITION)
2674     Inform MPFR that the significand of X has moved due to a garbage
2675     collect and update its new position to `new_position'.  However
2676     the application has to move the significand and the `mpfr_t'
2677     itself.  The behavior of this function for any `mpfr_t' not
2678     initialized with `mpfr_custom_init_set' is undefined.
2679
2680
2681File: mpfr.info,  Node: Internals,  Prev: Custom Interface,  Up: MPFR Interface
2682
26835.16 Internals
2684==============
2685
2686A "limb" means the part of a multi-precision number that fits in a
2687single word. Usually a limb contains 32 or 64 bits.  The C data type
2688for a limb is `mp_limb_t'.
2689
2690   The `mpfr_t' type is internally defined as a one-element array of a
2691structure, and `mpfr_ptr' is the C data type representing a pointer to
2692this structure.  The `mpfr_t' type consists of four fields:
2693
2694   * The `_mpfr_prec' field is used to store the precision of the
2695     variable (in bits); this is not less than `MPFR_PREC_MIN'.
2696
2697   * The `_mpfr_sign' field is used to store the sign of the variable.
2698
2699   * The `_mpfr_exp' field stores the exponent.  An exponent of 0 means
2700     a radix point just above the most significant limb.  Non-zero
2701     values n are a multiplier 2^n relative to that point.  A NaN, an
2702     infinity and a zero are indicated by special values of the exponent
2703     field.
2704
2705   * Finally, the `_mpfr_d' field is a pointer to the limbs, least
2706     significant limbs stored first.  The number of limbs in use is
2707     controlled by `_mpfr_prec', namely
2708     ceil(`_mpfr_prec'/`mp_bits_per_limb').  Non-singular (i.e.,
2709     different from NaN, Infinity or zero) values always have the most
2710     significant bit of the most significant limb set to 1.  When the
2711     precision does not correspond to a whole number of limbs, the
2712     excess bits at the low end of the data are zeros.
2713
2714
2715
2716File: mpfr.info,  Node: API Compatibility,  Next: Contributors,  Prev: MPFR Interface,  Up: Top
2717
27186 API Compatibility
2719*******************
2720
2721The goal of this section is to describe some API changes that occurred
2722from one version of MPFR to another, and how to write code that can be
2723compiled and run with older MPFR versions.  The minimum MPFR version
2724that is considered here is 2.2.0 (released on 20 September 2005).
2725
2726   API changes can only occur between major or minor versions.  Thus the
2727patchlevel (the third number in the MPFR version) will be ignored in
2728the following.  If a program does not use MPFR internals, changes in
2729the behavior between two versions differing only by the patchlevel
2730should only result from what was regarded as a bug or unspecified
2731behavior.
2732
2733   As a general rule, a program written for some MPFR version should
2734work with later versions, possibly except at a new major version, where
2735some features (described as obsolete for some time) can be removed.  In
2736such a case, a failure should occur during compilation or linking.  If
2737a result becomes incorrect because of such a change, please look at the
2738various changes below (they are minimal, and most software should be
2739unaffected), at the FAQ and at the MPFR web page for your version (a
2740bug could have been introduced and be already fixed); and if the
2741problem is not mentioned, please send us a bug report (*note Reporting
2742Bugs::).
2743
2744   However, a program written for the current MPFR version (as
2745documented by this manual) may not necessarily work with previous
2746versions of MPFR.  This section should help developers to write
2747portable code.
2748
2749   Note: Information given here may be incomplete.  API changes are
2750also described in the NEWS file (for each version, instead of being
2751classified like here), together with other changes.
2752
2753* Menu:
2754
2755* Type and Macro Changes::
2756* Added Functions::
2757* Changed Functions::
2758* Removed Functions::
2759* Other Changes::
2760
2761
2762File: mpfr.info,  Node: Type and Macro Changes,  Next: Added Functions,  Prev: API Compatibility,  Up: API Compatibility
2763
27646.1 Type and Macro Changes
2765==========================
2766
2767The official type for exponent values changed from `mp_exp_t' to
2768`mpfr_exp_t' in MPFR 3.0.  The type `mp_exp_t' will remain available as
2769it comes from GMP (with a different meaning).  These types are
2770currently the same (`mpfr_exp_t' is defined as `mp_exp_t' with
2771`typedef'), so that programs can still use `mp_exp_t'; but this may
2772change in the future.  Alternatively, using the following code after
2773including `mpfr.h' will work with official MPFR versions, as
2774`mpfr_exp_t' was never defined in MPFR 2.x:
2775     #if MPFR_VERSION_MAJOR < 3
2776     typedef mp_exp_t mpfr_exp_t;
2777     #endif
2778
2779   The official types for precision values and for rounding modes
2780respectively changed from `mp_prec_t' and `mp_rnd_t' to `mpfr_prec_t'
2781and `mpfr_rnd_t' in MPFR 3.0.  This change was actually done a long
2782time ago in MPFR, at least since MPFR 2.2.0, with the following code in
2783`mpfr.h':
2784     #ifndef mp_rnd_t
2785     # define mp_rnd_t  mpfr_rnd_t
2786     #endif
2787     #ifndef mp_prec_t
2788     # define mp_prec_t mpfr_prec_t
2789     #endif
2790   This means that it is safe to use the new official types
2791`mpfr_prec_t' and `mpfr_rnd_t' in your programs.  The types `mp_prec_t'
2792and `mp_rnd_t' (defined in MPFR only) may be removed in the future, as
2793the prefix `mp_' is reserved by GMP.
2794
2795   The precision type `mpfr_prec_t' (`mp_prec_t') was unsigned before
2796MPFR 3.0; it is now signed.  `MPFR_PREC_MAX' has not changed, though.
2797Indeed the MPFR code requires that `MPFR_PREC_MAX' be representable in
2798the exponent type, which may have the same size as `mpfr_prec_t' but
2799has always been signed.  The consequence is that valid code that does
2800not assume anything about the signedness of `mpfr_prec_t' should work
2801with past and new MPFR versions.  This change was useful as the use of
2802unsigned types tends to convert signed values to unsigned ones in
2803expressions due to the usual arithmetic conversions, which can yield
2804incorrect results if a negative value is converted in such a way.
2805Warning!  A program assuming (intentionally or not) that `mpfr_prec_t'
2806is signed may be affected by this problem when it is built and run
2807against MPFR 2.x.
2808
2809   The rounding modes `GMP_RNDx' were renamed to `MPFR_RNDx' in MPFR
28103.0. However the old names `GMP_RNDx' have been kept for compatibility
2811(this might change in future versions), using:
2812     #define GMP_RNDN MPFR_RNDN
2813     #define GMP_RNDZ MPFR_RNDZ
2814     #define GMP_RNDU MPFR_RNDU
2815     #define GMP_RNDD MPFR_RNDD
2816   The rounding mode "round away from zero" (`MPFR_RNDA') was added in
2817MPFR 3.0 (however no rounding mode `GMP_RNDA' exists).
2818
2819
2820File: mpfr.info,  Node: Added Functions,  Next: Changed Functions,  Prev: Type and Macro Changes,  Up: API Compatibility
2821
28226.2 Added Functions
2823===================
2824
2825We give here in alphabetical order the functions that were added after
2826MPFR 2.2, and in which MPFR version.
2827
2828   * `mpfr_add_d' in MPFR 2.4.
2829
2830   * `mpfr_ai' in MPFR 3.0 (incomplete, experimental).
2831
2832   * `mpfr_asprintf' in MPFR 2.4.
2833
2834   * `mpfr_buildopt_decimal_p' and `mpfr_buildopt_tls_p' in MPFR 3.0.
2835
2836   * `mpfr_buildopt_gmpinternals_p' and `mpfr_buildopt_tune_case' in
2837     MPFR 3.1.
2838
2839   * `mpfr_clear_divby0' in MPFR 3.1 (new divide-by-zero exception).
2840
2841   * `mpfr_copysign' in MPFR 2.3.  Note: MPFR 2.2 had a `mpfr_copysign'
2842     function that was available, but not documented, and with a slight
2843     difference in the semantics (when the second input operand is a
2844     NaN).
2845
2846   * `mpfr_custom_get_significand' in MPFR 3.0.  This function was
2847     named `mpfr_custom_get_mantissa' in previous versions;
2848     `mpfr_custom_get_mantissa' is still available via a macro in
2849     `mpfr.h':
2850          #define mpfr_custom_get_mantissa mpfr_custom_get_significand
2851     Thus code that needs to work with both MPFR 2.x and MPFR 3.x should
2852     use `mpfr_custom_get_mantissa'.
2853
2854   * `mpfr_d_div' and `mpfr_d_sub' in MPFR 2.4.
2855
2856   * `mpfr_digamma' in MPFR 3.0.
2857
2858   * `mpfr_divby0_p' in MPFR 3.1 (new divide-by-zero exception).
2859
2860   * `mpfr_div_d' in MPFR 2.4.
2861
2862   * `mpfr_fmod' in MPFR 2.4.
2863
2864   * `mpfr_fms' in MPFR 2.3.
2865
2866   * `mpfr_fprintf' in MPFR 2.4.
2867
2868   * `mpfr_frexp' in MPFR 3.1.
2869
2870   * `mpfr_get_flt' in MPFR 3.0.
2871
2872   * `mpfr_get_patches' in MPFR 2.3.
2873
2874   * `mpfr_get_z_2exp' in MPFR 3.0.  This function was named
2875     `mpfr_get_z_exp' in previous versions; `mpfr_get_z_exp' is still
2876     available via a macro in `mpfr.h':
2877          #define mpfr_get_z_exp mpfr_get_z_2exp
2878     Thus code that needs to work with both MPFR 2.x and MPFR 3.x should
2879     use `mpfr_get_z_exp'.
2880
2881   * `mpfr_grandom' in MPFR 3.1.
2882
2883   * `mpfr_j0', `mpfr_j1' and `mpfr_jn' in MPFR 2.3.
2884
2885   * `mpfr_lgamma' in MPFR 2.3.
2886
2887   * `mpfr_li2' in MPFR 2.4.
2888
2889   * `mpfr_min_prec' in MPFR 3.0.
2890
2891   * `mpfr_modf' in MPFR 2.4.
2892
2893   * `mpfr_mul_d' in MPFR 2.4.
2894
2895   * `mpfr_printf' in MPFR 2.4.
2896
2897   * `mpfr_rec_sqrt' in MPFR 2.4.
2898
2899   * `mpfr_regular_p' in MPFR 3.0.
2900
2901   * `mpfr_remainder' and `mpfr_remquo' in MPFR 2.3.
2902
2903   * `mpfr_set_divby0' in MPFR 3.1 (new divide-by-zero exception).
2904
2905   * `mpfr_set_flt' in MPFR 3.0.
2906
2907   * `mpfr_set_z_2exp' in MPFR 3.0.
2908
2909   * `mpfr_set_zero' in MPFR 3.0.
2910
2911   * `mpfr_setsign' in MPFR 2.3.
2912
2913   * `mpfr_signbit' in MPFR 2.3.
2914
2915   * `mpfr_sinh_cosh' in MPFR 2.4.
2916
2917   * `mpfr_snprintf' and `mpfr_sprintf' in MPFR 2.4.
2918
2919   * `mpfr_sub_d' in MPFR 2.4.
2920
2921   * `mpfr_urandom' in MPFR 3.0.
2922
2923   * `mpfr_vasprintf', `mpfr_vfprintf', `mpfr_vprintf',
2924     `mpfr_vsprintf' and `mpfr_vsnprintf' in MPFR 2.4.
2925
2926   * `mpfr_y0', `mpfr_y1' and `mpfr_yn' in MPFR 2.3.
2927
2928   * `mpfr_z_sub' in MPFR 3.1.
2929
2930
2931
2932File: mpfr.info,  Node: Changed Functions,  Next: Removed Functions,  Prev: Added Functions,  Up: API Compatibility
2933
29346.3 Changed Functions
2935=====================
2936
2937The following functions have changed after MPFR 2.2. Changes can affect
2938the behavior of code written for some MPFR version when built and run
2939against another MPFR version (older or newer), as described below.
2940
2941   * `mpfr_check_range' changed in MPFR 2.3.2 and MPFR 2.4.  If the
2942     value is an inexact infinity, the overflow flag is now set (in
2943     case it was lost), while it was previously left unchanged.  This
2944     is really what is expected in practice (and what the MPFR code was
2945     expecting), so that the previous behavior was regarded as a bug.
2946     Hence the change in MPFR 2.3.2.
2947
2948   * `mpfr_get_f' changed in MPFR 3.0.  This function was returning
2949     zero, except for NaN and Inf, which do not exist in MPF. The
2950     _erange_ flag is now set in these cases, and `mpfr_get_f' now
2951     returns the usual ternary value.
2952
2953   * `mpfr_get_si', `mpfr_get_sj', `mpfr_get_ui' and `mpfr_get_uj'
2954     changed in MPFR 3.0.  In previous MPFR versions, the cases where
2955     the _erange_ flag is set were unspecified.
2956
2957   * `mpfr_get_z' changed in MPFR 3.0.  The return type was `void'; it
2958     is now `int', and the usual ternary value is returned.  Thus
2959     programs that need to work with both MPFR 2.x and 3.x must not use
2960     the return value.  Even in this case, C code using `mpfr_get_z' as
2961     the second or third term of a conditional operator may also be
2962     affected. For instance, the following is correct with MPFR 3.0,
2963     but not with MPFR 2.x:
2964            bool ? mpfr_get_z(...) : mpfr_add(...);
2965     On the other hand, the following is correct with MPFR 2.x, but not
2966     with MPFR 3.0:
2967            bool ? mpfr_get_z(...) : (void) mpfr_add(...);
2968     Portable code should cast `mpfr_get_z(...)' to `void' to use the
2969     type `void' for both terms of the conditional operator, as in:
2970            bool ? (void) mpfr_get_z(...) : (void) mpfr_add(...);
2971     Alternatively, `if ... else' can be used instead of the
2972     conditional operator.
2973
2974     Moreover the cases where the _erange_ flag is set were unspecified
2975     in MPFR 2.x.
2976
2977   * `mpfr_get_z_exp' changed in MPFR 3.0.  In previous MPFR versions,
2978     the cases where the _erange_ flag is set were unspecified.  Note:
2979     this function has been renamed to `mpfr_get_z_2exp' in MPFR 3.0,
2980     but `mpfr_get_z_exp' is still available for compatibility reasons.
2981
2982   * `mpfr_strtofr' changed in MPFR 2.3.1 and MPFR 2.4.  This was
2983     actually a bug fix since the code and the documentation did not
2984     match.  But both were changed in order to have a more consistent
2985     and useful behavior.  The main changes in the code are as follows.
2986     The binary exponent is now accepted even without the `0b' or `0x'
2987     prefix.  Data corresponding to NaN can now have an optional sign
2988     (such data were previously invalid).
2989
2990   * `mpfr_strtofr' changed in MPFR 3.0.  This function now accepts
2991     bases from 37 to 62 (no changes for the other bases).  Note: if an
2992     unsupported base is provided to this function, the behavior is
2993     undefined; more precisely, in MPFR 2.3.1 and later, providing an
2994     unsupported base yields an assertion failure (this behavior may
2995     change in the future).
2996
2997   * `mpfr_subnormalize' changed in MPFR 3.1.  This was actually
2998     regarded as a bug fix. The `mpfr_subnormalize' implementation up
2999     to MPFR 3.0.0 did not change the flags. In particular, it did not
3000     follow the generic rule concerning the inexact flag (and no
3001     special behavior was specified). The case of the underflow flag
3002     was more a lack of specification.
3003
3004   * `mpfr_urandom' and `mpfr_urandomb' changed in MPFR 3.1.  Their
3005     behavior no longer depends on the platform (assuming this is also
3006     true for GMP's random generator, which is not the case between GMP
3007     4.1 and 4.2 if `gmp_randinit_default' is used).  As a consequence,
3008     the returned values can be different between MPFR 3.1 and previous
3009     MPFR versions.  Note: as the reproducibility of these functions
3010     was not specified before MPFR 3.1, the MPFR 3.1 behavior is _not_
3011     regarded as backward incompatible with previous versions.
3012
3013
3014
3015File: mpfr.info,  Node: Removed Functions,  Next: Other Changes,  Prev: Changed Functions,  Up: API Compatibility
3016
30176.4 Removed Functions
3018=====================
3019
3020Functions `mpfr_random' and `mpfr_random2' have been removed in MPFR
30213.0 (this only affects old code built against MPFR 3.0 or later).  (The
3022function `mpfr_random' had been deprecated since at least MPFR 2.2.0,
3023and `mpfr_random2' since MPFR 2.4.0.)
3024
3025
3026File: mpfr.info,  Node: Other Changes,  Prev: Removed Functions,  Up: API Compatibility
3027
30286.5 Other Changes
3029=================
3030
3031For users of a C++ compiler, the way how the availability of `intmax_t'
3032is detected has changed in MPFR 3.0.  In MPFR 2.x, if a macro
3033`INTMAX_C' or `UINTMAX_C' was defined (e.g. when the
3034`__STDC_CONSTANT_MACROS' macro had been defined before `<stdint.h>' or
3035`<inttypes.h>' has been included), `intmax_t' was assumed to be defined.
3036However this was not always the case (more precisely, `intmax_t' can be
3037defined only in the namespace `std', as with Boost), so that
3038compilations could fail.  Thus the check for `INTMAX_C' or `UINTMAX_C'
3039is now disabled for C++ compilers, with the following consequences:
3040
3041   * Programs written for MPFR 2.x that need `intmax_t' may no longer
3042     be compiled against MPFR 3.0: a `#define MPFR_USE_INTMAX_T' may be
3043     necessary before `mpfr.h' is included.
3044
3045   * The compilation of programs that work with MPFR 3.0 may fail with
3046     MPFR 2.x due to the problem described above.  Workarounds are
3047     possible, such as defining `intmax_t' and `uintmax_t' in the global
3048     namespace, though this is not clean.
3049
3050
3051   The divide-by-zero exception is new in MPFR 3.1. However it should
3052not introduce incompatible changes for programs that strictly follow
3053the MPFR API since the exception can only be seen via new functions.
3054
3055   As of MPFR 3.1, the `mpfr.h' header can be included several times,
3056while still supporting optional functions (*note Headers and
3057Libraries::).
3058
3059
3060File: mpfr.info,  Node: Contributors,  Next: References,  Prev: API Compatibility,  Up: Top
3061
3062Contributors
3063************
3064
3065The main developers of MPFR are Guillaume Hanrot, Vincent Lefèvre,
3066Patrick Pélissier, Philippe Théveny and Paul Zimmermann.
3067
3068   Sylvie Boldo from ENS-Lyon, France, contributed the functions
3069`mpfr_agm' and `mpfr_log'.  Sylvain Chevillard contributed the
3070`mpfr_ai' function.  David Daney contributed the hyperbolic and inverse
3071hyperbolic functions, the base-2 exponential, and the factorial
3072function.  Alain Delplanque contributed the new version of the
3073`mpfr_get_str' function.  Mathieu Dutour contributed the functions
3074`mpfr_acos', `mpfr_asin' and `mpfr_atan', and a previous version of
3075`mpfr_gamma'.  Laurent Fousse contributed the `mpfr_sum' function.
3076Emmanuel Jeandel, from ENS-Lyon too, contributed the generic
3077hypergeometric code, as well as the internal function `mpfr_exp3', a
3078first implementation of the sine and cosine, and improved versions of
3079`mpfr_const_log2' and `mpfr_const_pi'.  Ludovic Meunier helped in the
3080design of the `mpfr_erf' code.  Jean-Luc Rémy contributed the
3081`mpfr_zeta' code.  Fabrice Rouillier contributed the `mpfr_xxx_z' and
3082`mpfr_xxx_q' functions, and helped to the Microsoft Windows porting.
3083Damien Stehlé contributed the `mpfr_get_ld_2exp' function.
3084
3085   We would like to thank Jean-Michel Muller and Joris van der Hoeven
3086for very fruitful discussions at the beginning of that project,
3087Torbjörn Granlund and Kevin Ryde for their help about design issues,
3088and Nathalie Revol for her careful reading of a previous version of
3089this documentation. In particular Kevin Ryde did a tremendous job for
3090the portability of MPFR in 2002-2004.
3091
3092   The development of the MPFR library would not have been possible
3093without the continuous support of INRIA, and of the LORIA (Nancy,
3094France) and LIP (Lyon, France) laboratories. In particular the main
3095authors were or are members of the PolKA, Spaces, Cacao and Caramel
3096project-teams at LORIA and of the Arénaire and AriC project-teams at
3097LIP.  This project was started during the Fiable (reliable in French)
3098action supported by INRIA, and continued during the AOC action.  The
3099development of MPFR was also supported by a grant (202F0659 00 MPN 121)
3100from the Conseil Régional de Lorraine in 2002, from INRIA by an
3101"associate engineer" grant (2003-2005), an "opération de développement
3102logiciel" grant (2007-2009), and the post-doctoral grant of Sylvain
3103Chevillard in 2009-2010.  The MPFR-MPC workshop in June 2012 was partly
3104supported by the ERC grant ANTICS of Andreas Enge.
3105
3106
3107File: mpfr.info,  Node: References,  Next: GNU Free Documentation License,  Prev: Contributors,  Up: Top
3108
3109References
3110**********
3111
3112   * Richard Brent and Paul Zimmermann, "Modern Computer Arithmetic",
3113     Cambridge University Press (to appear), also available from the
3114     authors' web pages.
3115
3116   * Laurent Fousse, Guillaume Hanrot, Vincent Lefèvre, Patrick
3117     Pélissier and Paul Zimmermann, "MPFR: A Multiple-Precision Binary
3118     Floating-Point Library With Correct Rounding", ACM Transactions on
3119     Mathematical Software, volume 33, issue 2, article 13, 15 pages,
3120     2007, `http://doi.acm.org/10.1145/1236463.1236468'.
3121
3122   * Torbjörn Granlund, "GNU MP: The GNU Multiple Precision Arithmetic
3123     Library",   version 5.0.1, 2010, `http://gmplib.org'.
3124
3125   * IEEE standard for binary floating-point arithmetic, Technical
3126     Report ANSI-IEEE Standard 754-1985, New York, 1985.  Approved
3127     March 21, 1985: IEEE Standards Board; approved July 26,   1985:
3128     American National Standards Institute, 18 pages.
3129
3130   * IEEE Standard for Floating-Point Arithmetic, ANSI-IEEE Standard
3131     754-2008, 2008.  Revision of ANSI-IEEE Standard 754-1985, approved
3132     June 12, 2008: IEEE Standards Board, 70 pages.
3133
3134   * Donald E. Knuth, "The Art of Computer Programming", vol 2,
3135     "Seminumerical Algorithms", 2nd edition, Addison-Wesley, 1981.
3136
3137   * Jean-Michel Muller, "Elementary Functions, Algorithms and
3138     Implementation", Birkhäuser, Boston, 2nd edition, 2006.
3139
3140   * Jean-Michel Muller, Nicolas Brisebarre, Florent de Dinechin,
3141     Claude-Pierre Jeannerod, Vincent Lefèvre, Guillaume Melquiond,
3142     Nathalie Revol, Damien Stehlé and Serge Torrès, "Handbook of
3143     Floating-Point Arithmetic", Birkhäuser, Boston, 2009.
3144
3145
3146
3147File: mpfr.info,  Node: GNU Free Documentation License,  Next: Concept Index,  Prev: References,  Up: Top
3148
3149Appendix A GNU Free Documentation License
3150*****************************************
3151
3152                      Version 1.2, November 2002
3153
3154     Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
3155     51 Franklin St, Fifth Floor, Boston, MA  02110-1301, USA
3156
3157     Everyone is permitted to copy and distribute verbatim copies
3158     of this license document, but changing it is not allowed.
3159
3160  0. PREAMBLE
3161
3162     The purpose of this License is to make a manual, textbook, or other
3163     functional and useful document "free" in the sense of freedom: to
3164     assure everyone the effective freedom to copy and redistribute it,
3165     with or without modifying it, either commercially or
3166     noncommercially.  Secondarily, this License preserves for the
3167     author and publisher a way to get credit for their work, while not
3168     being considered responsible for modifications made by others.
3169
3170     This License is a kind of "copyleft", which means that derivative
3171     works of the document must themselves be free in the same sense.
3172     It complements the GNU General Public License, which is a copyleft
3173     license designed for free software.
3174
3175     We have designed this License in order to use it for manuals for
3176     free software, because free software needs free documentation: a
3177     free program should come with manuals providing the same freedoms
3178     that the software does.  But this License is not limited to
3179     software manuals; it can be used for any textual work, regardless
3180     of subject matter or whether it is published as a printed book.
3181     We recommend this License principally for works whose purpose is
3182     instruction or reference.
3183
3184  1. APPLICABILITY AND DEFINITIONS
3185
3186     This License applies to any manual or other work, in any medium,
3187     that contains a notice placed by the copyright holder saying it
3188     can be distributed under the terms of this License.  Such a notice
3189     grants a world-wide, royalty-free license, unlimited in duration,
3190     to use that work under the conditions stated herein.  The
3191     "Document", below, refers to any such manual or work.  Any member
3192     of the public is a licensee, and is addressed as "you".  You
3193     accept the license if you copy, modify or distribute the work in a
3194     way requiring permission under copyright law.
3195
3196     A "Modified Version" of the Document means any work containing the
3197     Document or a portion of it, either copied verbatim, or with
3198     modifications and/or translated into another language.
3199
3200     A "Secondary Section" is a named appendix or a front-matter section
3201     of the Document that deals exclusively with the relationship of the
3202     publishers or authors of the Document to the Document's overall
3203     subject (or to related matters) and contains nothing that could
3204     fall directly within that overall subject.  (Thus, if the Document
3205     is in part a textbook of mathematics, a Secondary Section may not
3206     explain any mathematics.)  The relationship could be a matter of
3207     historical connection with the subject or with related matters, or
3208     of legal, commercial, philosophical, ethical or political position
3209     regarding them.
3210
3211     The "Invariant Sections" are certain Secondary Sections whose
3212     titles are designated, as being those of Invariant Sections, in
3213     the notice that says that the Document is released under this
3214     License.  If a section does not fit the above definition of
3215     Secondary then it is not allowed to be designated as Invariant.
3216     The Document may contain zero Invariant Sections.  If the Document
3217     does not identify any Invariant Sections then there are none.
3218
3219     The "Cover Texts" are certain short passages of text that are
3220     listed, as Front-Cover Texts or Back-Cover Texts, in the notice
3221     that says that the Document is released under this License.  A
3222     Front-Cover Text may be at most 5 words, and a Back-Cover Text may
3223     be at most 25 words.
3224
3225     A "Transparent" copy of the Document means a machine-readable copy,
3226     represented in a format whose specification is available to the
3227     general public, that is suitable for revising the document
3228     straightforwardly with generic text editors or (for images
3229     composed of pixels) generic paint programs or (for drawings) some
3230     widely available drawing editor, and that is suitable for input to
3231     text formatters or for automatic translation to a variety of
3232     formats suitable for input to text formatters.  A copy made in an
3233     otherwise Transparent file format whose markup, or absence of
3234     markup, has been arranged to thwart or discourage subsequent
3235     modification by readers is not Transparent.  An image format is
3236     not Transparent if used for any substantial amount of text.  A
3237     copy that is not "Transparent" is called "Opaque".
3238
3239     Examples of suitable formats for Transparent copies include plain
3240     ASCII without markup, Texinfo input format, LaTeX input format,
3241     SGML or XML using a publicly available DTD, and
3242     standard-conforming simple HTML, PostScript or PDF designed for
3243     human modification.  Examples of transparent image formats include
3244     PNG, XCF and JPG.  Opaque formats include proprietary formats that
3245     can be read and edited only by proprietary word processors, SGML or
3246     XML for which the DTD and/or processing tools are not generally
3247     available, and the machine-generated HTML, PostScript or PDF
3248     produced by some word processors for output purposes only.
3249
3250     The "Title Page" means, for a printed book, the title page itself,
3251     plus such following pages as are needed to hold, legibly, the
3252     material this License requires to appear in the title page.  For
3253     works in formats which do not have any title page as such, "Title
3254     Page" means the text near the most prominent appearance of the
3255     work's title, preceding the beginning of the body of the text.
3256
3257     A section "Entitled XYZ" means a named subunit of the Document
3258     whose title either is precisely XYZ or contains XYZ in parentheses
3259     following text that translates XYZ in another language.  (Here XYZ
3260     stands for a specific section name mentioned below, such as
3261     "Acknowledgements", "Dedications", "Endorsements", or "History".)
3262     To "Preserve the Title" of such a section when you modify the
3263     Document means that it remains a section "Entitled XYZ" according
3264     to this definition.
3265
3266     The Document may include Warranty Disclaimers next to the notice
3267     which states that this License applies to the Document.  These
3268     Warranty Disclaimers are considered to be included by reference in
3269     this License, but only as regards disclaiming warranties: any other
3270     implication that these Warranty Disclaimers may have is void and
3271     has no effect on the meaning of this License.
3272
3273  2. VERBATIM COPYING
3274
3275     You may copy and distribute the Document in any medium, either
3276     commercially or noncommercially, provided that this License, the
3277     copyright notices, and the license notice saying this License
3278     applies to the Document are reproduced in all copies, and that you
3279     add no other conditions whatsoever to those of this License.  You
3280     may not use technical measures to obstruct or control the reading
3281     or further copying of the copies you make or distribute.  However,
3282     you may accept compensation in exchange for copies.  If you
3283     distribute a large enough number of copies you must also follow
3284     the conditions in section 3.
3285
3286     You may also lend copies, under the same conditions stated above,
3287     and you may publicly display copies.
3288
3289  3. COPYING IN QUANTITY
3290
3291     If you publish printed copies (or copies in media that commonly
3292     have printed covers) of the Document, numbering more than 100, and
3293     the Document's license notice requires Cover Texts, you must
3294     enclose the copies in covers that carry, clearly and legibly, all
3295     these Cover Texts: Front-Cover Texts on the front cover, and
3296     Back-Cover Texts on the back cover.  Both covers must also clearly
3297     and legibly identify you as the publisher of these copies.  The
3298     front cover must present the full title with all words of the
3299     title equally prominent and visible.  You may add other material
3300     on the covers in addition.  Copying with changes limited to the
3301     covers, as long as they preserve the title of the Document and
3302     satisfy these conditions, can be treated as verbatim copying in
3303     other respects.
3304
3305     If the required texts for either cover are too voluminous to fit
3306     legibly, you should put the first ones listed (as many as fit
3307     reasonably) on the actual cover, and continue the rest onto
3308     adjacent pages.
3309
3310     If you publish or distribute Opaque copies of the Document
3311     numbering more than 100, you must either include a
3312     machine-readable Transparent copy along with each Opaque copy, or
3313     state in or with each Opaque copy a computer-network location from
3314     which the general network-using public has access to download
3315     using public-standard network protocols a complete Transparent
3316     copy of the Document, free of added material.  If you use the
3317     latter option, you must take reasonably prudent steps, when you
3318     begin distribution of Opaque copies in quantity, to ensure that
3319     this Transparent copy will remain thus accessible at the stated
3320     location until at least one year after the last time you
3321     distribute an Opaque copy (directly or through your agents or
3322     retailers) of that edition to the public.
3323
3324     It is requested, but not required, that you contact the authors of
3325     the Document well before redistributing any large number of
3326     copies, to give them a chance to provide you with an updated
3327     version of the Document.
3328
3329  4. MODIFICATIONS
3330
3331     You may copy and distribute a Modified Version of the Document
3332     under the conditions of sections 2 and 3 above, provided that you
3333     release the Modified Version under precisely this License, with
3334     the Modified Version filling the role of the Document, thus
3335     licensing distribution and modification of the Modified Version to
3336     whoever possesses a copy of it.  In addition, you must do these
3337     things in the Modified Version:
3338
3339       A. Use in the Title Page (and on the covers, if any) a title
3340          distinct from that of the Document, and from those of
3341          previous versions (which should, if there were any, be listed
3342          in the History section of the Document).  You may use the
3343          same title as a previous version if the original publisher of
3344          that version gives permission.
3345
3346       B. List on the Title Page, as authors, one or more persons or
3347          entities responsible for authorship of the modifications in
3348          the Modified Version, together with at least five of the
3349          principal authors of the Document (all of its principal
3350          authors, if it has fewer than five), unless they release you
3351          from this requirement.
3352
3353       C. State on the Title page the name of the publisher of the
3354          Modified Version, as the publisher.
3355
3356       D. Preserve all the copyright notices of the Document.
3357
3358       E. Add an appropriate copyright notice for your modifications
3359          adjacent to the other copyright notices.
3360
3361       F. Include, immediately after the copyright notices, a license
3362          notice giving the public permission to use the Modified
3363          Version under the terms of this License, in the form shown in
3364          the Addendum below.
3365
3366       G. Preserve in that license notice the full lists of Invariant
3367          Sections and required Cover Texts given in the Document's
3368          license notice.
3369
3370       H. Include an unaltered copy of this License.
3371
3372       I. Preserve the section Entitled "History", Preserve its Title,
3373          and add to it an item stating at least the title, year, new
3374          authors, and publisher of the Modified Version as given on
3375          the Title Page.  If there is no section Entitled "History" in
3376          the Document, create one stating the title, year, authors,
3377          and publisher of the Document as given on its Title Page,
3378          then add an item describing the Modified Version as stated in
3379          the previous sentence.
3380
3381       J. Preserve the network location, if any, given in the Document
3382          for public access to a Transparent copy of the Document, and
3383          likewise the network locations given in the Document for
3384          previous versions it was based on.  These may be placed in
3385          the "History" section.  You may omit a network location for a
3386          work that was published at least four years before the
3387          Document itself, or if the original publisher of the version
3388          it refers to gives permission.
3389
3390       K. For any section Entitled "Acknowledgements" or "Dedications",
3391          Preserve the Title of the section, and preserve in the
3392          section all the substance and tone of each of the contributor
3393          acknowledgements and/or dedications given therein.
3394
3395       L. Preserve all the Invariant Sections of the Document,
3396          unaltered in their text and in their titles.  Section numbers
3397          or the equivalent are not considered part of the section
3398          titles.
3399
3400       M. Delete any section Entitled "Endorsements".  Such a section
3401          may not be included in the Modified Version.
3402
3403       N. Do not retitle any existing section to be Entitled
3404          "Endorsements" or to conflict in title with any Invariant
3405          Section.
3406
3407       O. Preserve any Warranty Disclaimers.
3408
3409     If the Modified Version includes new front-matter sections or
3410     appendices that qualify as Secondary Sections and contain no
3411     material copied from the Document, you may at your option
3412     designate some or all of these sections as invariant.  To do this,
3413     add their titles to the list of Invariant Sections in the Modified
3414     Version's license notice.  These titles must be distinct from any
3415     other section titles.
3416
3417     You may add a section Entitled "Endorsements", provided it contains
3418     nothing but endorsements of your Modified Version by various
3419     parties--for example, statements of peer review or that the text
3420     has been approved by an organization as the authoritative
3421     definition of a standard.
3422
3423     You may add a passage of up to five words as a Front-Cover Text,
3424     and a passage of up to 25 words as a Back-Cover Text, to the end
3425     of the list of Cover Texts in the Modified Version.  Only one
3426     passage of Front-Cover Text and one of Back-Cover Text may be
3427     added by (or through arrangements made by) any one entity.  If the
3428     Document already includes a cover text for the same cover,
3429     previously added by you or by arrangement made by the same entity
3430     you are acting on behalf of, you may not add another; but you may
3431     replace the old one, on explicit permission from the previous
3432     publisher that added the old one.
3433
3434     The author(s) and publisher(s) of the Document do not by this
3435     License give permission to use their names for publicity for or to
3436     assert or imply endorsement of any Modified Version.
3437
3438  5. COMBINING DOCUMENTS
3439
3440     You may combine the Document with other documents released under
3441     this License, under the terms defined in section 4 above for
3442     modified versions, provided that you include in the combination
3443     all of the Invariant Sections of all of the original documents,
3444     unmodified, and list them all as Invariant Sections of your
3445     combined work in its license notice, and that you preserve all
3446     their Warranty Disclaimers.
3447
3448     The combined work need only contain one copy of this License, and
3449     multiple identical Invariant Sections may be replaced with a single
3450     copy.  If there are multiple Invariant Sections with the same name
3451     but different contents, make the title of each such section unique
3452     by adding at the end of it, in parentheses, the name of the
3453     original author or publisher of that section if known, or else a
3454     unique number.  Make the same adjustment to the section titles in
3455     the list of Invariant Sections in the license notice of the
3456     combined work.
3457
3458     In the combination, you must combine any sections Entitled
3459     "History" in the various original documents, forming one section
3460     Entitled "History"; likewise combine any sections Entitled
3461     "Acknowledgements", and any sections Entitled "Dedications".  You
3462     must delete all sections Entitled "Endorsements."
3463
3464  6. COLLECTIONS OF DOCUMENTS
3465
3466     You may make a collection consisting of the Document and other
3467     documents released under this License, and replace the individual
3468     copies of this License in the various documents with a single copy
3469     that is included in the collection, provided that you follow the
3470     rules of this License for verbatim copying of each of the
3471     documents in all other respects.
3472
3473     You may extract a single document from such a collection, and
3474     distribute it individually under this License, provided you insert
3475     a copy of this License into the extracted document, and follow
3476     this License in all other respects regarding verbatim copying of
3477     that document.
3478
3479  7. AGGREGATION WITH INDEPENDENT WORKS
3480
3481     A compilation of the Document or its derivatives with other
3482     separate and independent documents or works, in or on a volume of
3483     a storage or distribution medium, is called an "aggregate" if the
3484     copyright resulting from the compilation is not used to limit the
3485     legal rights of the compilation's users beyond what the individual
3486     works permit.  When the Document is included in an aggregate, this
3487     License does not apply to the other works in the aggregate which
3488     are not themselves derivative works of the Document.
3489
3490     If the Cover Text requirement of section 3 is applicable to these
3491     copies of the Document, then if the Document is less than one half
3492     of the entire aggregate, the Document's Cover Texts may be placed
3493     on covers that bracket the Document within the aggregate, or the
3494     electronic equivalent of covers if the Document is in electronic
3495     form.  Otherwise they must appear on printed covers that bracket
3496     the whole aggregate.
3497
3498  8. TRANSLATION
3499
3500     Translation is considered a kind of modification, so you may
3501     distribute translations of the Document under the terms of section
3502     4.  Replacing Invariant Sections with translations requires special
3503     permission from their copyright holders, but you may include
3504     translations of some or all Invariant Sections in addition to the
3505     original versions of these Invariant Sections.  You may include a
3506     translation of this License, and all the license notices in the
3507     Document, and any Warranty Disclaimers, provided that you also
3508     include the original English version of this License and the
3509     original versions of those notices and disclaimers.  In case of a
3510     disagreement between the translation and the original version of
3511     this License or a notice or disclaimer, the original version will
3512     prevail.
3513
3514     If a section in the Document is Entitled "Acknowledgements",
3515     "Dedications", or "History", the requirement (section 4) to
3516     Preserve its Title (section 1) will typically require changing the
3517     actual title.
3518
3519  9. TERMINATION
3520
3521     You may not copy, modify, sublicense, or distribute the Document
3522     except as expressly provided for under this License.  Any other
3523     attempt to copy, modify, sublicense or distribute the Document is
3524     void, and will automatically terminate your rights under this
3525     License.  However, parties who have received copies, or rights,
3526     from you under this License will not have their licenses
3527     terminated so long as such parties remain in full compliance.
3528
3529 10. FUTURE REVISIONS OF THIS LICENSE
3530
3531     The Free Software Foundation may publish new, revised versions of
3532     the GNU Free Documentation License from time to time.  Such new
3533     versions will be similar in spirit to the present version, but may
3534     differ in detail to address new problems or concerns.  See
3535     `http://www.gnu.org/copyleft/'.
3536
3537     Each version of the License is given a distinguishing version
3538     number.  If the Document specifies that a particular numbered
3539     version of this License "or any later version" applies to it, you
3540     have the option of following the terms and conditions either of
3541     that specified version or of any later version that has been
3542     published (not as a draft) by the Free Software Foundation.  If
3543     the Document does not specify a version number of this License,
3544     you may choose any version ever published (not as a draft) by the
3545     Free Software Foundation.
3546
3547A.1 ADDENDUM: How to Use This License For Your Documents
3548========================================================
3549
3550To use this License in a document you have written, include a copy of
3551the License in the document and put the following copyright and license
3552notices just after the title page:
3553
3554       Copyright (C)  YEAR  YOUR NAME.
3555       Permission is granted to copy, distribute and/or modify this document
3556       under the terms of the GNU Free Documentation License, Version 1.2
3557       or any later version published by the Free Software Foundation;
3558       with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
3559       Texts.  A copy of the license is included in the section entitled ``GNU
3560       Free Documentation License''.
3561
3562   If you have Invariant Sections, Front-Cover Texts and Back-Cover
3563Texts, replace the "with...Texts." line with this:
3564
3565         with the Invariant Sections being LIST THEIR TITLES, with
3566         the Front-Cover Texts being LIST, and with the Back-Cover Texts
3567         being LIST.
3568
3569   If you have Invariant Sections without Cover Texts, or some other
3570combination of the three, merge those two alternatives to suit the
3571situation.
3572
3573   If your document contains nontrivial examples of program code, we
3574recommend releasing these examples in parallel under your choice of
3575free software license, such as the GNU General Public License, to
3576permit their use in free software.
3577
3578
3579File: mpfr.info,  Node: Concept Index,  Next: Function and Type Index,  Prev: GNU Free Documentation License,  Up: Top
3580
3581Concept Index
3582*************
3583
3584�[index�]
3585* Menu:
3586
3587* Accuracy:                              MPFR Interface.       (line 25)
3588* Arithmetic functions:                  Basic Arithmetic Functions.
3589                                                               (line  3)
3590* Assignment functions:                  Assignment Functions. (line  3)
3591* Basic arithmetic functions:            Basic Arithmetic Functions.
3592                                                               (line  3)
3593* Combined initialization and assignment functions: Combined Initialization and Assignment Functions.
3594                                                               (line  3)
3595* Comparison functions:                  Comparison Functions. (line  3)
3596* Compatibility with MPF:                Compatibility with MPF.
3597                                                               (line  3)
3598* Conditions for copying MPFR:           Copying.              (line  6)
3599* Conversion functions:                  Conversion Functions. (line  3)
3600* Copying conditions:                    Copying.              (line  6)
3601* Custom interface:                      Custom Interface.     (line  3)
3602* Exception related functions:           Exception Related Functions.
3603                                                               (line  3)
3604* Float arithmetic functions:            Basic Arithmetic Functions.
3605                                                               (line  3)
3606* Float comparisons functions:           Comparison Functions. (line  3)
3607* Float functions:                       MPFR Interface.       (line  6)
3608* Float input and output functions:      Input and Output Functions.
3609                                                               (line  3)
3610* Float output functions:                Formatted Output Functions.
3611                                                               (line  3)
3612* Floating-point functions:              MPFR Interface.       (line  6)
3613* Floating-point number:                 Nomenclature and Types.
3614                                                               (line  6)
3615* GNU Free Documentation License:        GNU Free Documentation License.
3616                                                               (line  6)
3617* I/O functions <1>:                     Formatted Output Functions.
3618                                                               (line  3)
3619* I/O functions:                         Input and Output Functions.
3620                                                               (line  3)
3621* Initialization functions:              Initialization Functions.
3622                                                               (line  3)
3623* Input functions:                       Input and Output Functions.
3624                                                               (line  3)
3625* Installation:                          Installing MPFR.      (line  6)
3626* Integer related functions:             Integer Related Functions.
3627                                                               (line  3)
3628* Internals:                             Internals.            (line  3)
3629* intmax_t:                              Headers and Libraries.
3630                                                               (line 22)
3631* inttypes.h:                            Headers and Libraries.
3632                                                               (line 22)
3633* libmpfr:                               Headers and Libraries.
3634                                                               (line 50)
3635* Libraries:                             Headers and Libraries.
3636                                                               (line 50)
3637* Libtool:                               Headers and Libraries.
3638                                                               (line 56)
3639* Limb:                                  Internals.            (line  6)
3640* Linking:                               Headers and Libraries.
3641                                                               (line 50)
3642* Miscellaneous float functions:         Miscellaneous Functions.
3643                                                               (line  3)
3644* mpfr.h:                                Headers and Libraries.
3645                                                               (line  6)
3646* Output functions <1>:                  Formatted Output Functions.
3647                                                               (line  3)
3648* Output functions:                      Input and Output Functions.
3649                                                               (line  3)
3650* Precision <1>:                         MPFR Interface.       (line 17)
3651* Precision:                             Nomenclature and Types.
3652                                                               (line 20)
3653* Reporting bugs:                        Reporting Bugs.       (line  6)
3654* Rounding mode related functions:       Rounding Related Functions.
3655                                                               (line  3)
3656* Rounding Modes:                        Nomenclature and Types.
3657                                                               (line 34)
3658* Special functions:                     Special Functions.    (line  3)
3659* stdarg.h:                              Headers and Libraries.
3660                                                               (line 19)
3661* stdint.h:                              Headers and Libraries.
3662                                                               (line 22)
3663* stdio.h:                               Headers and Libraries.
3664                                                               (line 12)
3665* Ternary value:                         Rounding Modes.       (line 29)
3666* uintmax_t:                             Headers and Libraries.
3667                                                               (line 22)
3668
3669
3670File: mpfr.info,  Node: Function and Type Index,  Prev: Concept Index,  Up: Top
3671
3672Function and Type Index
3673***********************
3674
3675�[index�]
3676* Menu:
3677
3678* mpfr_abs:                              Basic Arithmetic Functions.
3679                                                              (line 175)
3680* mpfr_acos:                             Special Functions.   (line  52)
3681* mpfr_acosh:                            Special Functions.   (line 136)
3682* mpfr_add:                              Basic Arithmetic Functions.
3683                                                              (line   8)
3684* mpfr_add_d:                            Basic Arithmetic Functions.
3685                                                              (line  14)
3686* mpfr_add_q:                            Basic Arithmetic Functions.
3687                                                              (line  18)
3688* mpfr_add_si:                           Basic Arithmetic Functions.
3689                                                              (line  12)
3690* mpfr_add_ui:                           Basic Arithmetic Functions.
3691                                                              (line  10)
3692* mpfr_add_z:                            Basic Arithmetic Functions.
3693                                                              (line  16)
3694* mpfr_agm:                              Special Functions.   (line 232)
3695* mpfr_ai:                               Special Functions.   (line 248)
3696* mpfr_asin:                             Special Functions.   (line  53)
3697* mpfr_asinh:                            Special Functions.   (line 137)
3698* mpfr_asprintf:                         Formatted Output Functions.
3699                                                              (line 194)
3700* mpfr_atan:                             Special Functions.   (line  54)
3701* mpfr_atan2:                            Special Functions.   (line  65)
3702* mpfr_atanh:                            Special Functions.   (line 138)
3703* mpfr_buildopt_decimal_p:               Miscellaneous Functions.
3704                                                              (line 163)
3705* mpfr_buildopt_gmpinternals_p:          Miscellaneous Functions.
3706                                                              (line 168)
3707* mpfr_buildopt_tls_p:                   Miscellaneous Functions.
3708                                                              (line 157)
3709* mpfr_buildopt_tune_case:               Miscellaneous Functions.
3710                                                              (line 173)
3711* mpfr_can_round:                        Rounding Related Functions.
3712                                                              (line  37)
3713* mpfr_cbrt:                             Basic Arithmetic Functions.
3714                                                              (line 109)
3715* mpfr_ceil:                             Integer Related Functions.
3716                                                              (line   8)
3717* mpfr_check_range:                      Exception Related Functions.
3718                                                              (line  38)
3719* mpfr_clear:                            Initialization Functions.
3720                                                              (line  31)
3721* mpfr_clear_divby0:                     Exception Related Functions.
3722                                                              (line 113)
3723* mpfr_clear_erangeflag:                 Exception Related Functions.
3724                                                              (line 116)
3725* mpfr_clear_flags:                      Exception Related Functions.
3726                                                              (line 129)
3727* mpfr_clear_inexflag:                   Exception Related Functions.
3728                                                              (line 115)
3729* mpfr_clear_nanflag:                    Exception Related Functions.
3730                                                              (line 114)
3731* mpfr_clear_overflow:                   Exception Related Functions.
3732                                                              (line 112)
3733* mpfr_clear_underflow:                  Exception Related Functions.
3734                                                              (line 111)
3735* mpfr_clears:                           Initialization Functions.
3736                                                              (line  36)
3737* mpfr_cmp:                              Comparison Functions.
3738                                                              (line   7)
3739* mpfr_cmp_d:                            Comparison Functions.
3740                                                              (line  10)
3741* mpfr_cmp_f:                            Comparison Functions.
3742                                                              (line  14)
3743* mpfr_cmp_ld:                           Comparison Functions.
3744                                                              (line  11)
3745* mpfr_cmp_q:                            Comparison Functions.
3746                                                              (line  13)
3747* mpfr_cmp_si:                           Comparison Functions.
3748                                                              (line   9)
3749* mpfr_cmp_si_2exp:                      Comparison Functions.
3750                                                              (line  31)
3751* mpfr_cmp_ui:                           Comparison Functions.
3752                                                              (line   8)
3753* mpfr_cmp_ui_2exp:                      Comparison Functions.
3754                                                              (line  29)
3755* mpfr_cmp_z:                            Comparison Functions.
3756                                                              (line  12)
3757* mpfr_cmpabs:                           Comparison Functions.
3758                                                              (line  35)
3759* mpfr_const_catalan:                    Special Functions.   (line 259)
3760* mpfr_const_euler:                      Special Functions.   (line 258)
3761* mpfr_const_log2:                       Special Functions.   (line 256)
3762* mpfr_const_pi:                         Special Functions.   (line 257)
3763* mpfr_copysign:                         Miscellaneous Functions.
3764                                                              (line 111)
3765* mpfr_cos:                              Special Functions.   (line  30)
3766* mpfr_cosh:                             Special Functions.   (line 115)
3767* mpfr_cot:                              Special Functions.   (line  48)
3768* mpfr_coth:                             Special Functions.   (line 132)
3769* mpfr_csc:                              Special Functions.   (line  47)
3770* mpfr_csch:                             Special Functions.   (line 131)
3771* mpfr_custom_get_exp:                   Custom Interface.    (line  78)
3772* mpfr_custom_get_kind:                  Custom Interface.    (line  67)
3773* mpfr_custom_get_significand:           Custom Interface.    (line  72)
3774* mpfr_custom_get_size:                  Custom Interface.    (line  36)
3775* mpfr_custom_init:                      Custom Interface.    (line  41)
3776* mpfr_custom_init_set:                  Custom Interface.    (line  48)
3777* mpfr_custom_move:                      Custom Interface.    (line  85)
3778* mpfr_d_div:                            Basic Arithmetic Functions.
3779                                                              (line  84)
3780* mpfr_d_sub:                            Basic Arithmetic Functions.
3781                                                              (line  37)
3782* MPFR_DECL_INIT:                        Initialization Functions.
3783                                                              (line  75)
3784* mpfr_digamma:                          Special Functions.   (line 187)
3785* mpfr_dim:                              Basic Arithmetic Functions.
3786                                                              (line 182)
3787* mpfr_div:                              Basic Arithmetic Functions.
3788                                                              (line  74)
3789* mpfr_div_2exp:                         Compatibility with MPF.
3790                                                              (line  51)
3791* mpfr_div_2si:                          Basic Arithmetic Functions.
3792                                                              (line 197)
3793* mpfr_div_2ui:                          Basic Arithmetic Functions.
3794                                                              (line 195)
3795* mpfr_div_d:                            Basic Arithmetic Functions.
3796                                                              (line  86)
3797* mpfr_div_q:                            Basic Arithmetic Functions.
3798                                                              (line  90)
3799* mpfr_div_si:                           Basic Arithmetic Functions.
3800                                                              (line  82)
3801* mpfr_div_ui:                           Basic Arithmetic Functions.
3802                                                              (line  78)
3803* mpfr_div_z:                            Basic Arithmetic Functions.
3804                                                              (line  88)
3805* mpfr_divby0_p:                         Exception Related Functions.
3806                                                              (line 135)
3807* mpfr_eint:                             Special Functions.   (line 154)
3808* mpfr_eq:                               Compatibility with MPF.
3809                                                              (line  30)
3810* mpfr_equal_p:                          Comparison Functions.
3811                                                              (line  61)
3812* mpfr_erangeflag_p:                     Exception Related Functions.
3813                                                              (line 138)
3814* mpfr_erf:                              Special Functions.   (line 198)
3815* mpfr_erfc:                             Special Functions.   (line 199)
3816* mpfr_exp:                              Special Functions.   (line  24)
3817* mpfr_exp10:                            Special Functions.   (line  26)
3818* mpfr_exp2:                             Special Functions.   (line  25)
3819* mpfr_expm1:                            Special Functions.   (line 150)
3820* mpfr_fac_ui:                           Special Functions.   (line 143)
3821* mpfr_fits_intmax_p:                    Conversion Functions.
3822                                                              (line 146)
3823* mpfr_fits_sint_p:                      Conversion Functions.
3824                                                              (line 142)
3825* mpfr_fits_slong_p:                     Conversion Functions.
3826                                                              (line 140)
3827* mpfr_fits_sshort_p:                    Conversion Functions.
3828                                                              (line 144)
3829* mpfr_fits_uint_p:                      Conversion Functions.
3830                                                              (line 141)
3831* mpfr_fits_uintmax_p:                   Conversion Functions.
3832                                                              (line 145)
3833* mpfr_fits_ulong_p:                     Conversion Functions.
3834                                                              (line 139)
3835* mpfr_fits_ushort_p:                    Conversion Functions.
3836                                                              (line 143)
3837* mpfr_floor:                            Integer Related Functions.
3838                                                              (line   9)
3839* mpfr_fma:                              Special Functions.   (line 225)
3840* mpfr_fmod:                             Integer Related Functions.
3841                                                              (line  79)
3842* mpfr_fms:                              Special Functions.   (line 227)
3843* mpfr_fprintf:                          Formatted Output Functions.
3844                                                              (line 158)
3845* mpfr_frac:                             Integer Related Functions.
3846                                                              (line  62)
3847* mpfr_free_cache:                       Special Functions.   (line 266)
3848* mpfr_free_str:                         Conversion Functions.
3849                                                              (line 133)
3850* mpfr_frexp:                            Conversion Functions.
3851                                                              (line  47)
3852* mpfr_gamma:                            Special Functions.   (line 169)
3853* mpfr_get_d:                            Conversion Functions.
3854                                                              (line   8)
3855* mpfr_get_d_2exp:                       Conversion Functions.
3856                                                              (line  34)
3857* mpfr_get_decimal64:                    Conversion Functions.
3858                                                              (line  10)
3859* mpfr_get_default_prec:                 Initialization Functions.
3860                                                              (line 114)
3861* mpfr_get_default_rounding_mode:        Rounding Related Functions.
3862                                                              (line  11)
3863* mpfr_get_emax:                         Exception Related Functions.
3864                                                              (line   8)
3865* mpfr_get_emax_max:                     Exception Related Functions.
3866                                                              (line  31)
3867* mpfr_get_emax_min:                     Exception Related Functions.
3868                                                              (line  30)
3869* mpfr_get_emin:                         Exception Related Functions.
3870                                                              (line   7)
3871* mpfr_get_emin_max:                     Exception Related Functions.
3872                                                              (line  29)
3873* mpfr_get_emin_min:                     Exception Related Functions.
3874                                                              (line  28)
3875* mpfr_get_exp:                          Miscellaneous Functions.
3876                                                              (line  89)
3877* mpfr_get_f:                            Conversion Functions.
3878                                                              (line  73)
3879* mpfr_get_flt:                          Conversion Functions.
3880                                                              (line   7)
3881* mpfr_get_ld:                           Conversion Functions.
3882                                                              (line   9)
3883* mpfr_get_ld_2exp:                      Conversion Functions.
3884                                                              (line  36)
3885* mpfr_get_patches:                      Miscellaneous Functions.
3886                                                              (line 148)
3887* mpfr_get_prec:                         Initialization Functions.
3888                                                              (line 147)
3889* mpfr_get_si:                           Conversion Functions.
3890                                                              (line  20)
3891* mpfr_get_sj:                           Conversion Functions.
3892                                                              (line  22)
3893* mpfr_get_str:                          Conversion Functions.
3894                                                              (line  87)
3895* mpfr_get_ui:                           Conversion Functions.
3896                                                              (line  21)
3897* mpfr_get_uj:                           Conversion Functions.
3898                                                              (line  23)
3899* mpfr_get_version:                      Miscellaneous Functions.
3900                                                              (line 117)
3901* mpfr_get_z:                            Conversion Functions.
3902                                                              (line  68)
3903* mpfr_get_z_2exp:                       Conversion Functions.
3904                                                              (line  55)
3905* mpfr_grandom:                          Miscellaneous Functions.
3906                                                              (line  65)
3907* mpfr_greater_p:                        Comparison Functions.
3908                                                              (line  57)
3909* mpfr_greaterequal_p:                   Comparison Functions.
3910                                                              (line  58)
3911* mpfr_hypot:                            Special Functions.   (line 241)
3912* mpfr_inexflag_p:                       Exception Related Functions.
3913                                                              (line 137)
3914* mpfr_inf_p:                            Comparison Functions.
3915                                                              (line  42)
3916* mpfr_init:                             Initialization Functions.
3917                                                              (line  54)
3918* mpfr_init2:                            Initialization Functions.
3919                                                              (line  11)
3920* mpfr_init_set:                         Combined Initialization and Assignment Functions.
3921                                                              (line   7)
3922* mpfr_init_set_d:                       Combined Initialization and Assignment Functions.
3923                                                              (line  12)
3924* mpfr_init_set_f:                       Combined Initialization and Assignment Functions.
3925                                                              (line  17)
3926* mpfr_init_set_ld:                      Combined Initialization and Assignment Functions.
3927                                                              (line  14)
3928* mpfr_init_set_q:                       Combined Initialization and Assignment Functions.
3929                                                              (line  16)
3930* mpfr_init_set_si:                      Combined Initialization and Assignment Functions.
3931                                                              (line  11)
3932* mpfr_init_set_str:                     Combined Initialization and Assignment Functions.
3933                                                              (line  23)
3934* mpfr_init_set_ui:                      Combined Initialization and Assignment Functions.
3935                                                              (line   9)
3936* mpfr_init_set_z:                       Combined Initialization and Assignment Functions.
3937                                                              (line  15)
3938* mpfr_inits:                            Initialization Functions.
3939                                                              (line  63)
3940* mpfr_inits2:                           Initialization Functions.
3941                                                              (line  23)
3942* mpfr_inp_str:                          Input and Output Functions.
3943                                                              (line  33)
3944* mpfr_integer_p:                        Integer Related Functions.
3945                                                              (line 105)
3946* mpfr_j0:                               Special Functions.   (line 203)
3947* mpfr_j1:                               Special Functions.   (line 204)
3948* mpfr_jn:                               Special Functions.   (line 206)
3949* mpfr_less_p:                           Comparison Functions.
3950                                                              (line  59)
3951* mpfr_lessequal_p:                      Comparison Functions.
3952                                                              (line  60)
3953* mpfr_lessgreater_p:                    Comparison Functions.
3954                                                              (line  66)
3955* mpfr_lgamma:                           Special Functions.   (line 179)
3956* mpfr_li2:                              Special Functions.   (line 164)
3957* mpfr_lngamma:                          Special Functions.   (line 173)
3958* mpfr_log:                              Special Functions.   (line  17)
3959* mpfr_log10:                            Special Functions.   (line  19)
3960* mpfr_log1p:                            Special Functions.   (line 146)
3961* mpfr_log2:                             Special Functions.   (line  18)
3962* mpfr_max:                              Miscellaneous Functions.
3963                                                              (line  24)
3964* mpfr_min:                              Miscellaneous Functions.
3965                                                              (line  22)
3966* mpfr_min_prec:                         Rounding Related Functions.
3967                                                              (line  59)
3968* mpfr_modf:                             Integer Related Functions.
3969                                                              (line  69)
3970* mpfr_mul:                              Basic Arithmetic Functions.
3971                                                              (line  53)
3972* mpfr_mul_2exp:                         Compatibility with MPF.
3973                                                              (line  49)
3974* mpfr_mul_2si:                          Basic Arithmetic Functions.
3975                                                              (line 190)
3976* mpfr_mul_2ui:                          Basic Arithmetic Functions.
3977                                                              (line 188)
3978* mpfr_mul_d:                            Basic Arithmetic Functions.
3979                                                              (line  59)
3980* mpfr_mul_q:                            Basic Arithmetic Functions.
3981                                                              (line  63)
3982* mpfr_mul_si:                           Basic Arithmetic Functions.
3983                                                              (line  57)
3984* mpfr_mul_ui:                           Basic Arithmetic Functions.
3985                                                              (line  55)
3986* mpfr_mul_z:                            Basic Arithmetic Functions.
3987                                                              (line  61)
3988* mpfr_nan_p:                            Comparison Functions.
3989                                                              (line  41)
3990* mpfr_nanflag_p:                        Exception Related Functions.
3991                                                              (line 136)
3992* mpfr_neg:                              Basic Arithmetic Functions.
3993                                                              (line 174)
3994* mpfr_nextabove:                        Miscellaneous Functions.
3995                                                              (line  16)
3996* mpfr_nextbelow:                        Miscellaneous Functions.
3997                                                              (line  17)
3998* mpfr_nexttoward:                       Miscellaneous Functions.
3999                                                              (line   7)
4000* mpfr_number_p:                         Comparison Functions.
4001                                                              (line  43)
4002* mpfr_out_str:                          Input and Output Functions.
4003                                                              (line  17)
4004* mpfr_overflow_p:                       Exception Related Functions.
4005                                                              (line 134)
4006* mpfr_pow:                              Basic Arithmetic Functions.
4007                                                              (line 118)
4008* mpfr_pow_si:                           Basic Arithmetic Functions.
4009                                                              (line 122)
4010* mpfr_pow_ui:                           Basic Arithmetic Functions.
4011                                                              (line 120)
4012* mpfr_pow_z:                            Basic Arithmetic Functions.
4013                                                              (line 124)
4014* mpfr_prec_round:                       Rounding Related Functions.
4015                                                              (line  15)
4016* mpfr_prec_t:                           Nomenclature and Types.
4017                                                              (line  20)
4018* mpfr_print_rnd_mode:                   Rounding Related Functions.
4019                                                              (line  66)
4020* mpfr_printf:                           Formatted Output Functions.
4021                                                              (line 165)
4022* mpfr_rec_sqrt:                         Basic Arithmetic Functions.
4023                                                              (line 104)
4024* mpfr_regular_p:                        Comparison Functions.
4025                                                              (line  45)
4026* mpfr_reldiff:                          Compatibility with MPF.
4027                                                              (line  41)
4028* mpfr_remainder:                        Integer Related Functions.
4029                                                              (line  81)
4030* mpfr_remquo:                           Integer Related Functions.
4031                                                              (line  83)
4032* mpfr_rint:                             Integer Related Functions.
4033                                                              (line   7)
4034* mpfr_rint_ceil:                        Integer Related Functions.
4035                                                              (line  38)
4036* mpfr_rint_floor:                       Integer Related Functions.
4037                                                              (line  40)
4038* mpfr_rint_round:                       Integer Related Functions.
4039                                                              (line  42)
4040* mpfr_rint_trunc:                       Integer Related Functions.
4041                                                              (line  44)
4042* mpfr_rnd_t:                            Nomenclature and Types.
4043                                                              (line  34)
4044* mpfr_root:                             Basic Arithmetic Functions.
4045                                                              (line 111)
4046* mpfr_round:                            Integer Related Functions.
4047                                                              (line  10)
4048* mpfr_sec:                              Special Functions.   (line  46)
4049* mpfr_sech:                             Special Functions.   (line 130)
4050* mpfr_set:                              Assignment Functions.
4051                                                              (line  10)
4052* mpfr_set_d:                            Assignment Functions.
4053                                                              (line  17)
4054* mpfr_set_decimal64:                    Assignment Functions.
4055                                                              (line  21)
4056* mpfr_set_default_prec:                 Initialization Functions.
4057                                                              (line 101)
4058* mpfr_set_default_rounding_mode:        Rounding Related Functions.
4059                                                              (line   7)
4060* mpfr_set_divby0:                       Exception Related Functions.
4061                                                              (line 122)
4062* mpfr_set_emax:                         Exception Related Functions.
4063                                                              (line  17)
4064* mpfr_set_emin:                         Exception Related Functions.
4065                                                              (line  16)
4066* mpfr_set_erangeflag:                   Exception Related Functions.
4067                                                              (line 125)
4068* mpfr_set_exp:                          Miscellaneous Functions.
4069                                                              (line  94)
4070* mpfr_set_f:                            Assignment Functions.
4071                                                              (line  24)
4072* mpfr_set_flt:                          Assignment Functions.
4073                                                              (line  16)
4074* mpfr_set_inexflag:                     Exception Related Functions.
4075                                                              (line 124)
4076* mpfr_set_inf:                          Assignment Functions.
4077                                                              (line 147)
4078* mpfr_set_ld:                           Assignment Functions.
4079                                                              (line  19)
4080* mpfr_set_nan:                          Assignment Functions.
4081                                                              (line 146)
4082* mpfr_set_nanflag:                      Exception Related Functions.
4083                                                              (line 123)
4084* mpfr_set_overflow:                     Exception Related Functions.
4085                                                              (line 121)
4086* mpfr_set_prec:                         Initialization Functions.
4087                                                              (line 137)
4088* mpfr_set_prec_raw:                     Compatibility with MPF.
4089                                                              (line  23)
4090* mpfr_set_q:                            Assignment Functions.
4091                                                              (line  23)
4092* mpfr_set_si:                           Assignment Functions.
4093                                                              (line  13)
4094* mpfr_set_si_2exp:                      Assignment Functions.
4095                                                              (line  53)
4096* mpfr_set_sj:                           Assignment Functions.
4097                                                              (line  15)
4098* mpfr_set_sj_2exp:                      Assignment Functions.
4099                                                              (line  57)
4100* mpfr_set_str:                          Assignment Functions.
4101                                                              (line  65)
4102* mpfr_set_ui:                           Assignment Functions.
4103                                                              (line  12)
4104* mpfr_set_ui_2exp:                      Assignment Functions.
4105                                                              (line  51)
4106* mpfr_set_uj:                           Assignment Functions.
4107                                                              (line  14)
4108* mpfr_set_uj_2exp:                      Assignment Functions.
4109                                                              (line  55)
4110* mpfr_set_underflow:                    Exception Related Functions.
4111                                                              (line 120)
4112* mpfr_set_z:                            Assignment Functions.
4113                                                              (line  22)
4114* mpfr_set_z_2exp:                       Assignment Functions.
4115                                                              (line  59)
4116* mpfr_set_zero:                         Assignment Functions.
4117                                                              (line 148)
4118* mpfr_setsign:                          Miscellaneous Functions.
4119                                                              (line 105)
4120* mpfr_sgn:                              Comparison Functions.
4121                                                              (line  51)
4122* mpfr_si_div:                           Basic Arithmetic Functions.
4123                                                              (line  80)
4124* mpfr_si_sub:                           Basic Arithmetic Functions.
4125                                                              (line  33)
4126* mpfr_signbit:                          Miscellaneous Functions.
4127                                                              (line 100)
4128* mpfr_sin:                              Special Functions.   (line  31)
4129* mpfr_sin_cos:                          Special Functions.   (line  37)
4130* mpfr_sinh:                             Special Functions.   (line 116)
4131* mpfr_sinh_cosh:                        Special Functions.   (line 122)
4132* mpfr_snprintf:                         Formatted Output Functions.
4133                                                              (line 182)
4134* mpfr_sprintf:                          Formatted Output Functions.
4135                                                              (line 171)
4136* mpfr_sqr:                              Basic Arithmetic Functions.
4137                                                              (line  70)
4138* mpfr_sqrt:                             Basic Arithmetic Functions.
4139                                                              (line  97)
4140* mpfr_sqrt_ui:                          Basic Arithmetic Functions.
4141                                                              (line  99)
4142* mpfr_strtofr:                          Assignment Functions.
4143                                                              (line  83)
4144* mpfr_sub:                              Basic Arithmetic Functions.
4145                                                              (line  27)
4146* mpfr_sub_d:                            Basic Arithmetic Functions.
4147                                                              (line  39)
4148* mpfr_sub_q:                            Basic Arithmetic Functions.
4149                                                              (line  45)
4150* mpfr_sub_si:                           Basic Arithmetic Functions.
4151                                                              (line  35)
4152* mpfr_sub_ui:                           Basic Arithmetic Functions.
4153                                                              (line  31)
4154* mpfr_sub_z:                            Basic Arithmetic Functions.
4155                                                              (line  43)
4156* mpfr_subnormalize:                     Exception Related Functions.
4157                                                              (line  61)
4158* mpfr_sum:                              Special Functions.   (line 275)
4159* mpfr_swap:                             Assignment Functions.
4160                                                              (line 154)
4161* mpfr_t:                                Nomenclature and Types.
4162                                                              (line   6)
4163* mpfr_tan:                              Special Functions.   (line  32)
4164* mpfr_tanh:                             Special Functions.   (line 117)
4165* mpfr_trunc:                            Integer Related Functions.
4166                                                              (line  11)
4167* mpfr_ui_div:                           Basic Arithmetic Functions.
4168                                                              (line  76)
4169* mpfr_ui_pow:                           Basic Arithmetic Functions.
4170                                                              (line 128)
4171* mpfr_ui_pow_ui:                        Basic Arithmetic Functions.
4172                                                              (line 126)
4173* mpfr_ui_sub:                           Basic Arithmetic Functions.
4174                                                              (line  29)
4175* mpfr_underflow_p:                      Exception Related Functions.
4176                                                              (line 133)
4177* mpfr_unordered_p:                      Comparison Functions.
4178                                                              (line  71)
4179* mpfr_urandom:                          Miscellaneous Functions.
4180                                                              (line  50)
4181* mpfr_urandomb:                         Miscellaneous Functions.
4182                                                              (line  30)
4183* mpfr_vasprintf:                        Formatted Output Functions.
4184                                                              (line 196)
4185* MPFR_VERSION:                          Miscellaneous Functions.
4186                                                              (line 120)
4187* MPFR_VERSION_MAJOR:                    Miscellaneous Functions.
4188                                                              (line 121)
4189* MPFR_VERSION_MINOR:                    Miscellaneous Functions.
4190                                                              (line 122)
4191* MPFR_VERSION_NUM:                      Miscellaneous Functions.
4192                                                              (line 140)
4193* MPFR_VERSION_PATCHLEVEL:               Miscellaneous Functions.
4194                                                              (line 123)
4195* MPFR_VERSION_STRING:                   Miscellaneous Functions.
4196                                                              (line 124)
4197* mpfr_vfprintf:                         Formatted Output Functions.
4198                                                              (line 160)
4199* mpfr_vprintf:                          Formatted Output Functions.
4200                                                              (line 166)
4201* mpfr_vsnprintf:                        Formatted Output Functions.
4202                                                              (line 184)
4203* mpfr_vsprintf:                         Formatted Output Functions.
4204                                                              (line 173)
4205* mpfr_y0:                               Special Functions.   (line 214)
4206* mpfr_y1:                               Special Functions.   (line 215)
4207* mpfr_yn:                               Special Functions.   (line 217)
4208* mpfr_z_sub:                            Basic Arithmetic Functions.
4209                                                              (line  41)
4210* mpfr_zero_p:                           Comparison Functions.
4211                                                              (line  44)
4212* mpfr_zeta:                             Special Functions.   (line 192)
4213* mpfr_zeta_ui:                          Special Functions.   (line 194)
4214
4215
4216
4217Tag Table:
4218Node: Top892
4219Node: Copying2243
4220Node: Introduction to MPFR4003
4221Node: Installing MPFR6092
4222Node: Reporting Bugs10914
4223Node: MPFR Basics12843
4224Node: Headers and Libraries13159
4225Node: Nomenclature and Types16143
4226Node: MPFR Variable Conventions18147
4227Node: Rounding Modes19677
4228Ref: ternary value20774
4229Node: Floating-Point Values on Special Numbers22727
4230Node: Exceptions25703
4231Node: Memory Handling28855
4232Node: MPFR Interface29987
4233Node: Initialization Functions32083
4234Node: Assignment Functions38997
4235Node: Combined Initialization and Assignment Functions47651
4236Node: Conversion Functions48944
4237Node: Basic Arithmetic Functions57496
4238Node: Comparison Functions66504
4239Node: Special Functions69986
4240Node: Input and Output Functions83739
4241Node: Formatted Output Functions85662
4242Node: Integer Related Functions94781
4243Node: Rounding Related Functions100543
4244Node: Miscellaneous Functions104157
4245Node: Exception Related Functions112724
4246Node: Compatibility with MPF119478
4247Node: Custom Interface122166
4248Node: Internals126411
4249Node: API Compatibility127895
4250Node: Type and Macro Changes129825
4251Node: Added Functions132546
4252Node: Changed Functions135489
4253Node: Removed Functions139770
4254Node: Other Changes140182
4255Node: Contributors141711
4256Node: References144285
4257Node: GNU Free Documentation License146026
4258Node: Concept Index168469
4259Node: Function and Type Index174388
4260
4261End Tag Table
4262
4263
4264Local Variables:
4265coding: utf-8
4266End:
4267