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