1 This is mpfr.info, produced by makeinfo version 4.13 from mpfr.texi.
3 This manual documents how to install and use the Multiple Precision
4 Floating-Point Reliable Library, version 2.4.2.
6 Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
7 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
10 Permission is granted to copy, distribute and/or modify this
11 document under the terms of the GNU Free Documentation License, Version
12 1.2 or any later version published by the Free Software Foundation;
13 with no Invariant Sections, with no Front-Cover Texts, and with no
14 Back-Cover Texts. A copy of the license is included in *note GNU Free
15 Documentation License::.
17 INFO-DIR-SECTION Software libraries
19 * mpfr: (mpfr). Multiple Precision Floating-Point Reliable Library.
23 File: mpfr.info, Node: Top, Next: Copying, Prev: (dir), Up: (dir)
28 This manual documents how to install and use the Multiple Precision
29 Floating-Point Reliable Library, version 2.4.2.
31 Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
32 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
35 Permission is granted to copy, distribute and/or modify this
36 document under the terms of the GNU Free Documentation License, Version
37 1.2 or any later version published by the Free Software Foundation;
38 with no Invariant Sections, with no Front-Cover Texts, and with no
39 Back-Cover Texts. A copy of the license is included in *note GNU Free
40 Documentation License::.
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.
53 * GNU Free Documentation License::
58 File: mpfr.info, Node: Copying, Next: Introduction to MPFR, Prev: Top, Up: Top
60 MPFR Copying Conditions
61 ***********************
63 This library is "free"; this means that everyone is free to use it and
64 free to redistribute it on a free basis. The library is not in the
65 public domain; it is copyrighted and there are restrictions on its
66 distribution, but these restrictions are designed to permit everything
67 that a good cooperating citizen would want to do. What is not allowed
68 is to try to prevent others from further sharing any version of this
69 library that they might get from you.
71 Specifically, we want to make sure that you have the right to give
72 away copies of the library, that you receive source code or else can
73 get it if you want it, that you can change this library or use pieces
74 of it in new free programs, and that you know you can do these things.
76 To make sure that everyone has such rights, we have to forbid you to
77 deprive anyone else of these rights. For example, if you distribute
78 copies of the GNU MPFR library, you must give the recipients all the
79 rights that you have. You must make sure that they, too, receive or
80 can get the source code. And you must tell them their rights.
82 Also, for our own protection, we must make certain that everyone
83 finds out that there is no warranty for the GNU MPFR library. If it is
84 modified by someone else and passed on, we want their recipients to
85 know that what they have is not what we distributed, so that any
86 problems introduced by others will not reflect on our reputation.
88 The precise conditions of the license for the GNU MPFR library are
89 found in the Lesser General Public License that accompanies the source
90 code. See the file COPYING.LIB.
93 File: mpfr.info, Node: Introduction to MPFR, Next: Installing MPFR, Prev: Copying, Up: Top
95 1 Introduction to MPFR
96 **********************
98 MPFR is a portable library written in C for arbitrary precision
99 arithmetic on floating-point numbers. It is based on the GNU MP library.
100 It aims to extend the class of floating-point numbers provided by the
101 GNU MP library by a precise semantics. The main differences with the
102 `mpf' class from GNU MP are:
104 * the MPFR code is portable, i.e. the result of any operation does
105 not depend (or should not) on the machine word size
106 `mp_bits_per_limb' (32 or 64 on most machines);
108 * the precision in bits can be set exactly to any valid value for
109 each variable (including very small precision);
111 * MPFR provides the four rounding modes from the IEEE 754-1985
114 In particular, with a precision of 53 bits, MPFR should be able to
115 exactly reproduce all computations with double-precision machine
116 floating-point numbers (e.g., `double' type in C, with a C
117 implementation that rigorously follows Annex F of the ISO C99 standard
118 and `FP_CONTRACT' pragma set to `OFF') on the four arithmetic
119 operations and the square root, except the default exponent range is
120 much wider and subnormal numbers are not implemented (but can be
123 This version of MPFR is released under the GNU Lesser General Public
124 License, Version 2.1 or any later version. It is permitted to link
125 MPFR to most non-free programs, as long as when distributing them the
126 MPFR source code and a means to re-link with a modified MPFR library is
129 1.1 How to Use This Manual
130 ==========================
132 Everyone should read *note MPFR Basics::. If you need to install the
133 library yourself, you need to read *note Installing MPFR::, too.
135 The rest of the manual can be used for later reference, although it
136 is probably a good idea to glance through it.
139 File: mpfr.info, Node: Installing MPFR, Next: Reporting Bugs, Prev: Introduction to MPFR, Up: Top
147 Here are the steps needed to install the library on Unix systems (more
148 details are provided in the `INSTALL' file):
150 1. To build MPFR, you first have to install GNU MP (version 4.1 or
151 higher) on your computer. You need a C compiler, preferably GCC,
152 but any reasonable compiler should work. And you need a standard
153 Unix `make' program, plus some other standard Unix utility
156 Then, in the MPFR build directory, type the following commands.
160 This will prepare the build and setup the options according to
161 your system. You can give options to specify the install
162 directories (instead of the default `/usr/local'), threading
163 support, and so on. See the `INSTALL' file and/or the output of
164 `./configure --help' for more information, in particular if you
169 This will compile MPFR, and create a library archive file
170 `libmpfr.a'. On most platforms, a dynamic library will be
171 produced too (see configure).
175 This will make sure MPFR was built correctly. If you get error
176 messages, please report this to `mpfr@loria.fr'. (*Note Reporting
177 Bugs::, for information on what to include in useful bug reports.)
181 This will copy the files `mpfr.h' and `mpf2mpfr.h' to the directory
182 `/usr/local/include', the library files (`libmpfr.a' and possibly
183 others) to the directory `/usr/local/lib', the file `mpfr.info' to
184 the directory `/usr/local/share/info', and some other documentation
185 files to the directory `/usr/local/share/doc/mpfr' (or if you
186 passed the `--prefix' option to `configure', using the prefix
187 directory given as argument to `--prefix' instead of `/usr/local').
189 2.2 Other `make' Targets
190 ========================
192 There are some other useful make targets:
194 * `mpfr.info' or `info'
196 Create or update an info version of the manual, in `mpfr.info'.
198 This file is already provided in the MPFR archives.
200 * `mpfr.pdf' or `pdf'
202 Create a PDF version of the manual, in `mpfr.pdf'.
204 * `mpfr.dvi' or `dvi'
206 Create a DVI version of the manual, in `mpfr.dvi'.
210 Create a Postscript version of the manual, in `mpfr.ps'.
212 * `mpfr.html' or `html'
214 Create a HTML version of the manual, in several pages in the
215 directory `mpfr.html'; if you want only one output HTML file, then
216 type `makeinfo --html --no-split mpfr.texi' instead.
220 Delete all object files and archive files, but not the
225 Delete all generated files not included in the distribution.
229 Delete all files copied by `make install'.
234 In case of problem, please read the `INSTALL' file carefully before
235 reporting a bug, in particular section "In case of problem". Some
236 problems are due to bad configuration on the user side (not specific to
237 MPFR). Problems are also mentioned in the FAQ
238 `http://www.mpfr.org/faq.html'.
240 Please report problems to `mpfr@loria.fr'. *Note Reporting Bugs::.
241 Some bug fixes are available on the MPFR 2.4.2 web page
242 `http://www.mpfr.org/mpfr-2.4.2/'.
244 2.4 Getting the Latest Version of MPFR
245 ======================================
247 The latest version of MPFR is available from
248 `ftp://ftp.gnu.org/gnu/mpfr/' or `http://www.mpfr.org/'.
251 File: mpfr.info, Node: Reporting Bugs, Next: MPFR Basics, Prev: Installing MPFR, Up: Top
256 If you think you have found a bug in the MPFR library, first have a look
257 on the MPFR 2.4.2 web page `http://www.mpfr.org/mpfr-2.4.2/' and the
258 FAQ `http://www.mpfr.org/faq.html': perhaps this bug is already known,
259 in which case you may find there a workaround for it. Otherwise, please
260 investigate and report it. We have made this library available to you,
261 and it is not to ask too much from you, to ask you to report the bugs
264 There are a few things you should think about when you put your bug
267 You have to send us a test case that makes it possible for us to
268 reproduce the bug. Include instructions on how to run the test case.
270 You also have to explain what is wrong; if you get a crash, or if
271 the results printed are incorrect and in that case, in what way.
273 Please include compiler version information in your bug report. This
274 can be extracted using `cc -V' on some machines, or, if you're using
275 gcc, `gcc -v'. Also, include the output from `uname -a' and the MPFR
276 version (the GMP version may be useful too).
278 If your bug report is good, we will do our best to help you to get a
279 corrected version of the library; if the bug report is poor, we will
280 not do anything about it (aside of chiding you to send better bug
283 Send your bug report to: `mpfr@loria.fr'.
285 If you think something in this manual is unclear, or downright
286 incorrect, or if the language needs to be improved, please send a note
290 File: mpfr.info, Node: MPFR Basics, Next: MPFR Interface, Prev: Reporting Bugs, Up: Top
295 4.1 Headers and Libraries
296 =========================
298 All declarations needed to use MPFR are collected in the include file
299 `mpfr.h'. It is designed to work with both C and C++ compilers. You
300 should include that file in any program using the MPFR library:
304 Note however that prototypes for MPFR functions with `FILE *'
305 parameters are provided only if `<stdio.h>' is included too (before
311 Likewise `<stdarg.h>' (or `<varargs.h>') is required for prototypes
312 with `va_list' parameters, such as `mpfr_vprintf'.
314 And for any functions using `intmax_t', you must include
315 `<stdint.h>' or `<inttypes.h>' before `mpfr.h', to allow `mpfr.h' to
316 define prototypes for these functions. Moreover, users of C++ compilers
317 under some platforms may need to define the `__STDC_CONSTANT_MACROS'
318 macro (before `<stdint.h>' or `<inttypes.h>' has been included) or
319 `MPFR_USE_INTMAX_T' (before `mpfr.h' has been included), at least for
320 portability; of course, it is possible to do that on the command line,
321 e.g., with `-DMPFR_USE_INTMAX_T'.
323 You can avoid the use of MPFR macros encapsulating functions by
324 defining the `MPFR_USE_NO_MACRO' macro before `mpfr.h' is included. In
325 general this should not be necessary, but this can be useful when
326 debugging user code: with some macros, the compiler may emit spurious
327 warnings with some warning options, and macros can prevent some
330 All programs using MPFR must link against both `libmpfr' and
331 `libgmp' libraries. On a typical Unix-like system this can be done
332 with `-lmpfr -lgmp' (in that order), for example
334 gcc myprogram.c -lmpfr -lgmp
336 MPFR is built using Libtool and an application can use that to link
337 if desired, *note GNU Libtool: (libtool.info)Top.
339 If MPFR has been installed to a non-standard location, then it may be
340 necessary to set up environment variables such as `C_INCLUDE_PATH' and
341 `LIBRARY_PATH', or use `-I' and `-L' compiler options, in order to
342 point to the right directories. For a shared library, it may also be
343 necessary to set up some sort of run-time library path (e.g.,
344 `LD_LIBRARY_PATH') on some systems. Please read the `INSTALL' file for
345 additional information.
347 4.2 Nomenclature and Types
348 ==========================
350 A "floating-point number" or "float" for short, is an arbitrary
351 precision significand (also called mantissa) with a limited precision
352 exponent. The C data type for such objects is `mpfr_t' (internally
353 defined as a one-element array of a structure, and `mpfr_ptr' is the C
354 data type representing a pointer to this structure). A floating-point
355 number can have three special values: Not-a-Number (NaN) or plus or
356 minus Infinity. NaN represents an uninitialized object, the result of
357 an invalid operation (like 0 divided by 0), or a value that cannot be
358 determined (like +Infinity minus +Infinity). Moreover, like in the IEEE
359 754 standard, zero is signed, i.e. there are both +0 and -0; the
360 behavior is the same as in the IEEE 754 standard and it is generalized
361 to the other functions supported by MPFR. Unless documented otherwise,
362 the sign bit of a NaN is unspecified.
364 The "precision" is the number of bits used to represent the significand
365 of a floating-point number; the corresponding C data type is
366 `mp_prec_t'. The precision can be any integer between `MPFR_PREC_MIN'
367 and `MPFR_PREC_MAX'. In the current implementation, `MPFR_PREC_MIN' is
370 Warning! MPFR needs to increase the precision internally, in order to
371 provide accurate results (and in particular, correct rounding). Do not
372 attempt to set the precision to any value near `MPFR_PREC_MAX',
373 otherwise MPFR will abort due to an assertion failure. Moreover, you
374 may reach some memory limit on your platform, in which case the program
375 may abort, crash or have undefined behavior (depending on your C
378 The "rounding mode" specifies the way to round the result of a
379 floating-point operation, in case the exact result can not be
380 represented exactly in the destination significand; the corresponding C
381 data type is `mp_rnd_t'.
383 A "limb" means the part of a multi-precision number that fits in a
384 single word. (We chose this word because a limb of the human body is
385 analogous to a digit, only larger, and containing several digits.)
386 Normally a limb contains 32 or 64 bits. The C data type for a limb is
392 There is only one class of functions in the MPFR library:
394 1. Functions for floating-point arithmetic, with names beginning with
395 `mpfr_'. The associated type is `mpfr_t'.
397 4.4 MPFR Variable Conventions
398 =============================
400 As a general rule, all MPFR functions expect output arguments before
401 input arguments. This notation is based on an analogy with the
404 MPFR allows you to use the same variable for both input and output
405 in the same expression. For example, the main function for
406 floating-point multiplication, `mpfr_mul', can be used like this:
407 `mpfr_mul (x, x, x, rnd_mode)'. This computes the square of X with
408 rounding mode `rnd_mode' and puts the result back in X.
410 Before you can assign to an MPFR variable, you need to initialize it
411 by calling one of the special initialization functions. When you're
412 done with a variable, you need to clear it out, using one of the
413 functions for that purpose.
415 A variable should only be initialized once, or at least cleared out
416 between each initialization. After a variable has been initialized, it
417 may be assigned to any number of times.
419 For efficiency reasons, avoid to initialize and clear out a variable
420 in loops. Instead, initialize it before entering the loop, and clear
421 it out after the loop has exited.
423 You do not need to be concerned about allocating additional space
424 for MPFR variables, since any variable has a significand of fixed size.
425 Hence unless you change its precision, or clear and reinitialize it, a
426 floating-point variable will have the same allocated space during all
432 The following four rounding modes are supported:
434 * `GMP_RNDN': round to nearest (roundTiesToEven in IEEE 754-2008)
436 * `GMP_RNDZ': round toward zero (roundTowardZero in IEEE 754-2008)
438 * `GMP_RNDU': round toward plus infinity (roundTowardPositive in
441 * `GMP_RNDD': round toward minus infinity (roundTowardNegative in
444 The `round to nearest' mode works as in the IEEE 754 standard: in
445 case the number to be rounded lies exactly in the middle of two
446 representable numbers, it is rounded to the one with the least
447 significant bit set to zero. For example, the number 5/2, which is
448 represented by (10.1) in binary, is rounded to (10.0)=2 with a
449 precision of two bits, and not to (11.0)=3. This rule avoids the
450 "drift" phenomenon mentioned by Knuth in volume 2 of The Art of
451 Computer Programming (Section 4.2.2).
453 Most MPFR functions take as first argument the destination variable,
454 as second and following arguments the input variables, as last argument
455 a rounding mode, and have a return value of type `int', called the
456 "ternary value". The value stored in the destination variable is
457 correctly rounded, i.e. MPFR behaves as if it computed the result with
458 an infinite precision, then rounded it to the precision of this
459 variable. The input variables are regarded as exact (in particular,
460 their precision does not affect the result).
462 As a consequence, in case of a non-zero real rounded result, the
463 error on the result is less or equal to 1/2 ulp (unit in the last
464 place) of the target in the rounding to nearest mode, and less than 1
465 ulp of the target in the directed rounding modes (a ulp is the weight
466 of the least significant represented bit of the target after rounding).
468 Unless documented otherwise, functions returning an `int' return a
469 ternary value. If the ternary value is zero, it means that the value
470 stored in the destination variable is the exact result of the
471 corresponding mathematical function. If the ternary value is positive
472 (resp. negative), it means the value stored in the destination variable
473 is greater (resp. lower) than the exact result. For example with the
474 `GMP_RNDU' rounding mode, the ternary value is usually positive, except
475 when the result is exact, in which case it is zero. In the case of an
476 infinite result, it is considered as inexact when it was obtained by
477 overflow, and exact otherwise. A NaN result (Not-a-Number) always
478 corresponds to an exact return value. The opposite of a returned
479 ternary value is guaranteed to be representable in an `int'.
481 Unless documented otherwise, functions returning a `1' (or any other
482 value specified in this manual) for special cases (like `acos(0)')
483 should return an overflow or an underflow if `1' is not representable
484 in the current exponent range.
486 4.6 Floating-Point Values on Special Numbers
487 ============================================
489 This section specifies the floating-point values (of type `mpfr_t')
490 returned by MPFR functions. For functions returning several values (like
491 `mpfr_sin_cos'), the rules apply to each result separately.
493 Functions can have one or several input arguments. An input point is
494 a mapping from these input arguments to the set of the MPFR numbers.
495 When none of its components are NaN, an input point can also be seen as
496 a tuple in the extended real numbers (the set of the real numbers with
499 When the input point is in the domain of the mathematical function,
500 the result is rounded as described in Section "Rounding Modes" (but see
501 below for the specification of the sign of an exact zero). Otherwise
502 the general rules from this section apply unless stated otherwise in
503 the description of the MPFR function (*note MPFR Interface::).
505 When the input point is not in the domain of the mathematical
506 function but is in its closure in the extended real numbers and the
507 function can be extended by continuity, the result is the obtained
508 limit. Examples: `mpfr_hypot' on (+Inf,0) gives +Inf. But `mpfr_pow'
509 cannot be defined on (1,+Inf) using this rule, as one can find
510 sequences (X_N,Y_N) such that X_N goes to 1, Y_N goes to +Inf and X_N
511 to the Y_N goes to any positive value when N goes to the infinity.
513 When the input point is in the closure of the domain of the
514 mathematical function and an input argument is +0 (resp. -0), one
515 considers the limit when the corresponding argument approaches 0 from
516 above (resp. below). If the limit is not defined (e.g., `mpfr_log' on
517 -0), the behavior must be specified in the description of the MPFR
520 When the result is equal to 0, its sign is determined by considering
521 the limit as if the input point were not in the domain: If one
522 approaches 0 from above (resp. below), the result is +0 (resp. -0). In
523 the other cases, the sign must be specified in the description of the
524 MPFR function. Example: `mpfr_sin' on +0 gives +0.
526 When the input point is not in the closure of the domain of the
527 function, the result is NaN. Example: `mpfr_sqrt' on -17 gives NaN.
529 When an input argument is NaN, the result is NaN, possibly except
530 when a partial function is constant on the finite floating-point
531 numbers; such a case is always explicitly specified in *note MPFR
532 Interface::. Example: `mpfr_hypot' on (NaN,0) gives NaN, but
533 `mpfr_hypot' on (NaN,+Inf) gives +Inf (as specified in *note Special
534 Functions::), since for any finite input X, `mpfr_hypot' on (X,+Inf)
540 MPFR supports 5 exception types:
542 * Underflow: An underflow occurs when the exact result of a function
543 is a non-zero real number and the result obtained after the
544 rounding, assuming an unbounded exponent range (for the rounding),
545 has an exponent smaller than the minimum exponent of the current
546 range. In the round-to-nearest mode, the halfway case is rounded
549 Note: This is not the single definition of the underflow. MPFR
550 chooses to consider the underflow after rounding. The underflow
551 before rounding can also be defined. For instance, consider a
552 function that has the exact result 7 multiplied by two to the power
553 E-4, where E is the smallest exponent (for a significand between
554 1/2 and 1) in the current range, with a 2-bit target precision and
555 rounding toward plus infinity. The exact result has the exponent
556 E-1. With the underflow before rounding, such a function call
557 would yield an underflow, as E-1 is outside the current exponent
558 range. However, MPFR first considers the rounded result assuming
559 an unbounded exponent range. The exact result cannot be
560 represented exactly in precision 2, and here, it is rounded to 0.5
561 times 2 to E, which is representable in the current exponent
562 range. As a consequence, this will not yield an underflow in MPFR.
564 * Overflow: An overflow occurs when the exact result of a function
565 is a non-zero real number and the result obtained after the
566 rounding, assuming an unbounded exponent range (for the rounding),
567 has an exponent larger than the maximum exponent of the current
568 range. In the round-to-nearest mode, the result is infinite.
570 * NaN: A NaN exception occurs when the result of a function is a NaN.
572 * Inexact: An inexact exception occurs when the result of a function
573 cannot be represented exactly and must be rounded.
575 * Range error: A range exception occurs when a function that does
576 not return a MPFR number (such as comparisons and conversions to
577 an integer) has an invalid result (e.g. an argument is NaN in
578 `mpfr_cmp' or in a conversion to an integer).
581 MPFR has a global flag for each exception, which can be cleared, set
582 or tested by functions described in *note Exception Related Functions::.
584 Differences with the ISO C99 standard:
586 * In C, only quiet NaNs are specified, and a NaN propagation does not
587 raise an invalid exception. Unless explicitly stated otherwise,
588 MPFR sets the NaN flag whenever a NaN is generated, even when a
589 NaN is propagated (e.g. in NaN + NaN), as if all NaNs were
592 * An invalid exception in C corresponds to either a NaN exception or
593 a range error in MPFR.
599 MPFR functions may create caches, e.g. when computing constants such as
600 Pi, either because the user has called a function like `mpfr_const_pi'
601 directly or because such a function was called internally by the MPFR
602 library itself to compute some other function.
604 At any time, the user can free the various caches with
605 `mpfr_free_cache'. It is strongly advised to do that before terminating
606 a thread, or before exiting when using tools like `valgrind' (to avoid
607 memory leaks being reported).
609 MPFR internal data such as flags, the exponent range, the default
610 precision and rounding mode, and caches (i.e., data that are not
611 accessed via parameters) are either global (if MPFR has not been
612 compiled as thread safe) or per-thread (thread local storage).
615 File: mpfr.info, Node: MPFR Interface, Next: Contributors, Prev: MPFR Basics, Up: Top
620 The floating-point functions expect arguments of type `mpfr_t'.
622 The MPFR floating-point functions have an interface that is similar
623 to the GNU MP integer functions. The function prefix for
624 floating-point operations is `mpfr_'.
626 There is one significant characteristic of floating-point numbers
627 that has motivated a difference between this function class and other
628 GNU MP function classes: the inherent inexactness of floating-point
629 arithmetic. The user has to specify the precision for each variable.
630 A computation that assigns a variable will take place with the
631 precision of the assigned variable; the cost of that computation should
632 not depend from the precision of variables used as input (on average).
634 The semantics of a calculation in MPFR is specified as follows:
635 Compute the requested operation exactly (with "infinite accuracy"), and
636 round the result to the precision of the destination variable, with the
637 given rounding mode. The MPFR floating-point functions are intended to
638 be a smooth extension of the IEEE 754 arithmetic. The results obtained
639 on one computer should not differ from the results obtained on a
640 computer with a different word size.
642 MPFR does not keep track of the accuracy of a computation. This is
643 left to the user or to a higher layer. As a consequence, if two
644 variables are used to store only a few significant bits, and their
645 product is stored in a variable with large precision, then MPFR will
646 still compute the result with full precision.
648 The value of the standard C macro `errno' may be set to non-zero by
649 any MPFR function or macro, whether or not there is an error.
653 * Initialization Functions::
654 * Assignment Functions::
655 * Combined Initialization and Assignment Functions::
656 * Conversion Functions::
657 * Basic Arithmetic Functions::
658 * Comparison Functions::
659 * Special Functions::
660 * Input and Output Functions::
661 * Formatted Output Functions::
662 * Integer Related Functions::
663 * Rounding Related Functions::
664 * Miscellaneous Functions::
665 * Exception Related Functions::
666 * Compatibility with MPF::
671 File: mpfr.info, Node: Initialization Functions, Next: Assignment Functions, Prev: MPFR Interface, Up: MPFR Interface
673 5.1 Initialization Functions
674 ============================
676 An `mpfr_t' object must be initialized before storing the first value in
677 it. The functions `mpfr_init' and `mpfr_init2' are used for that
680 -- Function: void mpfr_init2 (mpfr_t X, mp_prec_t PREC)
681 Initialize X, set its precision to be *exactly* PREC bits and its
682 value to NaN. (Warning: the corresponding `mpf' functions
683 initialize to zero instead.)
685 Normally, a variable should be initialized once only or at least
686 be cleared, using `mpfr_clear', between initializations. To
687 change the precision of a variable which has already been
688 initialized, use `mpfr_set_prec'. The precision PREC must be an
689 integer between `MPFR_PREC_MIN' and `MPFR_PREC_MAX' (otherwise the
690 behavior is undefined).
692 -- Function: void mpfr_inits2 (mp_prec_t PREC, mpfr_t X, ...)
693 Initialize all the `mpfr_t' variables of the given `va_list', set
694 their precision to be *exactly* PREC bits and their value to NaN.
695 See `mpfr_init2' for more details. The `va_list' is assumed to be
696 composed only of type `mpfr_t' (or equivalently `mpfr_ptr'). It
697 begins from X. It ends when it encounters a null pointer (whose
698 type must also be `mpfr_ptr').
700 -- Function: void mpfr_clear (mpfr_t X)
701 Free the space occupied by X. Make sure to call this function for
702 all `mpfr_t' variables when you are done with them.
704 -- Function: void mpfr_clears (mpfr_t X, ...)
705 Free the space occupied by all the `mpfr_t' variables of the given
706 `va_list'. See `mpfr_clear' for more details. The `va_list' is
707 assumed to be composed only of type `mpfr_t' (or equivalently
708 `mpfr_ptr'). It begins from X. It ends when it encounters a null
709 pointer (whose type must also be `mpfr_ptr').
711 Here is an example of how to use multiple initialization functions:
715 mpfr_inits2 (256, x, y, z, t, (mpfr_ptr) 0);
717 mpfr_clears (x, y, z, t, (mpfr_ptr) 0);
720 -- Function: void mpfr_init (mpfr_t X)
721 Initialize X and set its value to NaN.
723 Normally, a variable should be initialized once only or at least
724 be cleared, using `mpfr_clear', between initializations. The
725 precision of X is the default precision, which can be changed by a
726 call to `mpfr_set_default_prec'.
728 Warning! In a given program, some other libraries might change the
729 default precision and not restore it. Thus it is safer to use
732 -- Function: void mpfr_inits (mpfr_t X, ...)
733 Initialize all the `mpfr_t' variables of the given `va_list', set
734 their precision to be the default precision and their value to NaN.
735 See `mpfr_init' for more details. The `va_list' is assumed to be
736 composed only of type `mpfr_t' (or equivalently `mpfr_ptr'). It
737 begins from X. It ends when it encounters a null pointer (whose
738 type must also be `mpfr_ptr').
740 Warning! In a given program, some other libraries might change the
741 default precision and not restore it. Thus it is safer to use
744 -- Macro: MPFR_DECL_INIT (NAME, PREC)
745 This macro declares NAME as an automatic variable of type `mpfr_t',
746 initializes it and sets its precision to be *exactly* PREC bits
747 and its value to NaN. NAME must be a valid identifier. You must
748 use this macro in the declaration section. This macro is much
749 faster than using `mpfr_init2' but has some drawbacks:
751 * You *must not* call `mpfr_clear' with variables created with
752 this macro (the storage is allocated at the point of
753 declaration and deallocated when the brace-level is exited).
755 * You *cannot* change their precision.
757 * You *should not* create variables with huge precision with
760 * Your compiler must support `Non-Constant Initializers'
761 (standard in C++ and ISO C99) and `Token Pasting' (standard
762 in ISO C89). If PREC is not a constant expression, your
763 compiler must support `variable-length automatic arrays'
764 (standard in ISO C99). `GCC 2.95.3' and above supports all
765 these features. If you compile your program with gcc in c89
766 mode and with `-pedantic', you may want to define the
767 `MPFR_USE_EXTENSION' macro to avoid warnings due to the
768 `MPFR_DECL_INIT' implementation.
770 -- Function: void mpfr_set_default_prec (mp_prec_t PREC)
771 Set the default precision to be *exactly* PREC bits. The
772 precision of a variable means the number of bits used to store its
773 significand. All subsequent calls to `mpfr_init' will use this
774 precision, but previously initialized variables are unaffected.
775 This default precision is set to 53 bits initially. The precision
776 can be any integer between `MPFR_PREC_MIN' and `MPFR_PREC_MAX'.
778 -- Function: mp_prec_t mpfr_get_default_prec (void)
779 Return the default MPFR precision in bits.
781 Here is an example on how to initialize floating-point variables:
785 mpfr_init (x); /* use default precision */
786 mpfr_init2 (y, 256); /* precision _exactly_ 256 bits */
788 /* When the program is about to exit, do ... */
794 The following functions are useful for changing the precision during
795 a calculation. A typical use would be for adjusting the precision
796 gradually in iterative algorithms like Newton-Raphson, making the
797 computation precision closely match the actual accurate part of the
800 -- Function: void mpfr_set_prec (mpfr_t X, mp_prec_t PREC)
801 Reset the precision of X to be *exactly* PREC bits, and set its
802 value to NaN. The previous value stored in X is lost. It is
803 equivalent to a call to `mpfr_clear(x)' followed by a call to
804 `mpfr_init2(x, prec)', but more efficient as no allocation is done
805 in case the current allocated space for the significand of X is
806 enough. The precision PREC can be any integer between
807 `MPFR_PREC_MIN' and `MPFR_PREC_MAX'.
809 In case you want to keep the previous value stored in X, use
810 `mpfr_prec_round' instead.
812 -- Function: mp_prec_t mpfr_get_prec (mpfr_t X)
813 Return the precision actually used for assignments of X, i.e. the
814 number of bits used to store its significand.
817 File: mpfr.info, Node: Assignment Functions, Next: Combined Initialization and Assignment Functions, Prev: Initialization Functions, Up: MPFR Interface
819 5.2 Assignment Functions
820 ========================
822 These functions assign new values to already initialized floats (*note
823 Initialization Functions::).
825 -- Function: int mpfr_set (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
826 -- Function: int mpfr_set_ui (mpfr_t ROP, unsigned long int OP,
828 -- Function: int mpfr_set_si (mpfr_t ROP, long int OP, mp_rnd_t RND)
829 -- Function: int mpfr_set_uj (mpfr_t ROP, uintmax_t OP, mp_rnd_t RND)
830 -- Function: int mpfr_set_sj (mpfr_t ROP, intmax_t OP, mp_rnd_t RND)
831 -- Function: int mpfr_set_d (mpfr_t ROP, double OP, mp_rnd_t RND)
832 -- Function: int mpfr_set_ld (mpfr_t ROP, long double OP, mp_rnd_t RND)
833 -- Function: int mpfr_set_decimal64 (mpfr_t ROP, _Decimal64 OP,
835 -- Function: int mpfr_set_z (mpfr_t ROP, mpz_t OP, mp_rnd_t RND)
836 -- Function: int mpfr_set_q (mpfr_t ROP, mpq_t OP, mp_rnd_t RND)
837 -- Function: int mpfr_set_f (mpfr_t ROP, mpf_t OP, mp_rnd_t RND)
838 Set the value of ROP from OP, rounded toward the given direction
839 RND. Note that the input 0 is converted to +0 by `mpfr_set_ui',
840 `mpfr_set_si', `mpfr_set_sj', `mpfr_set_uj', `mpfr_set_z',
841 `mpfr_set_q' and `mpfr_set_f', regardless of the rounding mode.
842 If the system does not support the IEEE 754 standard, `mpfr_set_d',
843 `mpfr_set_ld' and `mpfr_set_decimal64' might not preserve the
844 signed zeros. The `mpfr_set_decimal64' function is built only
845 with the configure option `--enable-decimal-float', which also
846 requires `--with-gmp-build', and when the compiler or system
847 provides the `_Decimal64' data type (GCC version 4.2.0 is known to
848 support this data type, but only when configured with
849 `--enable-decimal-float' too). `mpfr_set_q' might not be able to
850 work if the numerator (or the denominator) can not be
851 representable as a `mpfr_t'.
853 Note: If you want to store a floating-point constant to a `mpfr_t',
854 you should use `mpfr_set_str' (or one of the MPFR constant
855 functions, such as `mpfr_const_pi' for Pi) instead of `mpfr_set_d',
856 `mpfr_set_ld' or `mpfr_set_decimal64'. Otherwise the
857 floating-point constant will be first converted into a
858 reduced-precision (e.g., 53-bit) binary number before MPFR can
861 -- Function: int mpfr_set_ui_2exp (mpfr_t ROP, unsigned long int OP,
862 mp_exp_t E, mp_rnd_t RND)
863 -- Function: int mpfr_set_si_2exp (mpfr_t ROP, long int OP, mp_exp_t
865 -- Function: int mpfr_set_uj_2exp (mpfr_t ROP, uintmax_t OP, intmax_t
867 -- Function: int mpfr_set_sj_2exp (mpfr_t ROP, intmax_t OP, intmax_t
869 Set the value of ROP from OP multiplied by two to the power E,
870 rounded toward the given direction RND. Note that the input 0 is
873 -- Function: int mpfr_set_str (mpfr_t ROP, const char *S, int BASE,
875 Set ROP to the value of the string S in base BASE, rounded in the
876 direction RND. See the documentation of `mpfr_strtofr' for a
877 detailed description of the valid string formats. Contrary to
878 `mpfr_strtofr', `mpfr_set_str' requires the _whole_ string to
879 represent a valid floating-point number. This function returns 0
880 if the entire string up to the final null character is a valid
881 number in base BASE; otherwise it returns -1, and ROP may have
884 -- Function: int mpfr_strtofr (mpfr_t ROP, const char *NPTR, char
885 **ENDPTR, int BASE, mp_rnd_t RND)
886 Read a floating-point number from a string NPTR in base BASE,
887 rounded in the direction RND; BASE must be either 0 (to detect the
888 base, as described below) or a number from 2 to 36 (otherwise the
889 behavior is undefined). If NPTR starts with valid data, the result
890 is stored in ROP and `*ENDPTR' points to the character just after
891 the valid data (if ENDPTR is not a null pointer); otherwise ROP is
892 set to zero and the value of NPTR is stored in the location
893 referenced by ENDPTR (if ENDPTR is not a null pointer). The usual
894 ternary value is returned.
896 Parsing follows the standard C `strtod' function with some
897 extensions. Case is ignored. After optional leading whitespace,
898 one has a subject sequence consisting of an optional sign (`+' or
899 `-'), and either numeric data or special data. The subject
900 sequence is defined as the longest initial subsequence of the
901 input string, starting with the first non-whitespace character,
902 that is of the expected form.
904 The form of numeric data is a non-empty sequence of significand
905 digits with an optional decimal point, and an optional exponent
906 consisting of an exponent prefix followed by an optional sign and
907 a non-empty sequence of decimal digits. A significand digit is
908 either a decimal digit or a Latin letter (62 possible characters),
909 with `a' = 10, `b' = 11, ..., `z' = 35; its value must be strictly
910 less than the base. The decimal point can be either the one
911 defined by the current locale or the period (the first one is
912 accepted for consistency with the C standard and the practice, the
913 second one is accepted to allow the programmer to provide MPFR
914 numbers from strings in a way that does not depend on the current
915 locale). The exponent prefix can be `e' or `E' for bases up to
916 10, or `@' in any base; it indicates a multiplication by a power
917 of the base. In bases 2 and 16, the exponent prefix can also be
918 `p' or `P', in which case it introduces a binary exponent: it
919 indicates a multiplication by a power of 2 (there is a difference
920 only for base 16). The value of an exponent is always written in
921 base 10. In base 2, the significand can start with `0b' or `0B',
922 and in base 16, it can start with `0x' or `0X'.
924 If the argument BASE is 0, then the base is automatically detected
925 as follows. If the significand starts with `0b' or `0B', base 2 is
926 assumed. If the significand starts with `0x' or `0X', base 16 is
927 assumed. Otherwise base 10 is assumed.
929 Note: The exponent must contain at least a digit. Otherwise the
930 possible exponent prefix and sign are not part of the number
931 (which ends with the significand). Similarly, if `0b', `0B', `0x'
932 or `0X' is not followed by a binary/hexadecimal digit, then the
933 subject sequence stops at the character `0'.
935 Special data (for infinities and NaN) can be `@inf@' or
936 `@nan@(n-char-sequence)', and if BASE <= 16, it can also be
937 `infinity', `inf', `nan' or `nan(n-char-sequence-opt)', all case
938 insensitive. A `n-char-sequence-opt' is a possibly empty string
939 containing only digits, Latin letters and the underscore (0, 1, 2,
940 ..., 9, a, b, ..., z, A, B, ..., Z, _). Note: one has an optional
941 sign for all data, even NaN.
944 -- Function: void mpfr_set_inf (mpfr_t X, int SIGN)
945 -- Function: void mpfr_set_nan (mpfr_t X)
946 Set the variable X to infinity or NaN (Not-a-Number) respectively.
947 In `mpfr_set_inf', X is set to plus infinity iff SIGN is
950 -- Function: void mpfr_swap (mpfr_t X, mpfr_t Y)
951 Swap the values X and Y efficiently. Warning: the precisions are
952 exchanged too; in case the precisions are different, `mpfr_swap'
953 is thus not equivalent to three `mpfr_set' calls using a third
957 File: mpfr.info, Node: Combined Initialization and Assignment Functions, Next: Conversion Functions, Prev: Assignment Functions, Up: MPFR Interface
959 5.3 Combined Initialization and Assignment Functions
960 ====================================================
962 -- Macro: int mpfr_init_set (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
963 -- Macro: int mpfr_init_set_ui (mpfr_t ROP, unsigned long int OP,
965 -- Macro: int mpfr_init_set_si (mpfr_t ROP, signed long int OP,
967 -- Macro: int mpfr_init_set_d (mpfr_t ROP, double OP, mp_rnd_t RND)
968 -- Macro: int mpfr_init_set_ld (mpfr_t ROP, long double OP, mp_rnd_t
970 -- Macro: int mpfr_init_set_z (mpfr_t ROP, mpz_t OP, mp_rnd_t RND)
971 -- Macro: int mpfr_init_set_q (mpfr_t ROP, mpq_t OP, mp_rnd_t RND)
972 -- Macro: int mpfr_init_set_f (mpfr_t ROP, mpf_t OP, mp_rnd_t RND)
973 Initialize ROP and set its value from OP, rounded in the direction
974 RND. The precision of ROP will be taken from the active default
975 precision, as set by `mpfr_set_default_prec'.
977 -- Function: int mpfr_init_set_str (mpfr_t X, const char *S, int BASE,
979 Initialize X and set its value from the string S in base BASE,
980 rounded in the direction RND. See `mpfr_set_str'.
983 File: mpfr.info, Node: Conversion Functions, Next: Basic Arithmetic Functions, Prev: Combined Initialization and Assignment Functions, Up: MPFR Interface
985 5.4 Conversion Functions
986 ========================
988 -- Function: double mpfr_get_d (mpfr_t OP, mp_rnd_t RND)
989 -- Function: long double mpfr_get_ld (mpfr_t OP, mp_rnd_t RND)
990 -- Function: _Decimal64 mpfr_get_decimal64 (mpfr_t OP, mp_rnd_t RND)
991 Convert OP to a `double' (respectively `_Decimal64' or `long
992 double'), using the rounding mode RND. If OP is NaN, some fixed
993 NaN (either quiet or signaling) or the result of 0.0/0.0 is
994 returned. If OP is ±Inf, an infinity of the same sign or the
995 result of ±1.0/0.0 is returned. If OP is zero, these functions
996 return a zero, trying to preserve its sign, if possible. The
997 `mpfr_get_decimal64' function is built only under some conditions:
998 see the documentation of `mpfr_set_decimal64'.
1000 -- Function: double mpfr_get_d_2exp (long *EXP, mpfr_t OP, mp_rnd_t
1002 -- Function: long double mpfr_get_ld_2exp (long *EXP, mpfr_t OP,
1004 Return D and set EXP such that 0.5<=abs(D)<1 and D times 2 raised
1005 to EXP equals OP rounded to double (resp. long double) precision,
1006 using the given rounding mode. If OP is zero, then a zero of the
1007 same sign (or an unsigned zero, if the implementation does not
1008 have signed zeros) is returned, and EXP is set to 0. If OP is NaN
1009 or an infinity, then the corresponding double precision (resp.
1010 long-double precision) value is returned, and EXP is undefined.
1012 -- Function: long mpfr_get_si (mpfr_t OP, mp_rnd_t RND)
1013 -- Function: unsigned long mpfr_get_ui (mpfr_t OP, mp_rnd_t RND)
1014 -- Function: intmax_t mpfr_get_sj (mpfr_t OP, mp_rnd_t RND)
1015 -- Function: uintmax_t mpfr_get_uj (mpfr_t OP, mp_rnd_t RND)
1016 Convert OP to a `long', an `unsigned long', an `intmax_t' or an
1017 `uintmax_t' (respectively) after rounding it with respect to RND.
1018 If OP is NaN, the result is undefined. If OP is too big for the
1019 return type, it returns the maximum or the minimum of the
1020 corresponding C type, depending on the direction of the overflow.
1021 The _erange_ flag is set too. See also `mpfr_fits_slong_p',
1022 `mpfr_fits_ulong_p', `mpfr_fits_intmax_p' and
1023 `mpfr_fits_uintmax_p'.
1025 -- Function: mp_exp_t mpfr_get_z_exp (mpz_t ROP, mpfr_t OP)
1026 Put the scaled significand of OP (regarded as an integer, with the
1027 precision of OP) into ROP, and return the exponent EXP (which may
1028 be outside the current exponent range) such that OP exactly equals
1029 ROP multiplied by two exponent EXP. If OP is zero, the minimal
1030 exponent `emin' is returned. If the exponent is not representable
1031 in the `mp_exp_t' type, the behavior is undefined.
1033 -- Function: void mpfr_get_z (mpz_t ROP, mpfr_t OP, mp_rnd_t RND)
1034 Convert OP to a `mpz_t', after rounding it with respect to RND. If
1035 OP is NaN or Inf, the result is undefined.
1037 -- Function: int mpfr_get_f (mpf_t ROP, mpfr_t OP, mp_rnd_t RND)
1038 Convert OP to a `mpf_t', after rounding it with respect to RND.
1039 Return zero iff no error occurred, in particular a non-zero value
1040 is returned if OP is NaN or Inf, which do not exist in `mpf'.
1042 -- Function: char * mpfr_get_str (char *STR, mp_exp_t *EXPPTR, int B,
1043 size_t N, mpfr_t OP, mp_rnd_t RND)
1044 Convert OP to a string of digits in base B, with rounding in the
1045 direction RND, where N is either zero (see below) or the number of
1046 significant digits; in the latter case, N must be greater or equal
1047 to 2. The base may vary from 2 to 36.
1049 The generated string is a fraction, with an implicit radix point
1050 immediately to the left of the first digit. For example, the
1051 number -3.1416 would be returned as "-31416" in the string and 1
1052 written at EXPPTR. If RND is to nearest, and OP is exactly in the
1053 middle of two possible outputs, the one with an even significand
1054 is chosen: that significand is considered with the exponent of OP.
1055 Note that for an odd base, this may not correspond to an even last
1056 digit: for example with 2 digits in base 7, 16 and a half is
1057 rounded to 20 which is 14 in decimal, 36 and a half is rounded to
1058 40 which is 28 in decimal, and 66 and a half is rounded to 66
1059 which is 48 in decimal.
1061 If N is zero, the number of digits of the significand is chosen
1062 large enough so that re-reading the printed value with the same
1063 precision, assuming both output and input use rounding to nearest,
1064 will recover the original value of OP. More precisely, in most
1065 cases, the chosen precision of STR is the minimal precision
1066 depending on P = PREC(OP) and B only that satisfies the above
1067 property, i.e., m = 1 + ceil(P*log(2)/log(B)), with P replaced by
1068 P-1 if B is a power of 2, but in some very rare cases, it might be
1069 m+1 (the smallest case for bases up to 62 is when P equals
1070 186564318007 for bases 7 and 49).
1072 If STR is a null pointer, space for the significand is allocated
1073 using the current allocation function, and a pointer to the string
1074 is returned. To free the returned string, you must use
1077 If STR is not a null pointer, it should point to a block of storage
1078 large enough for the significand, i.e., at least `max(N + 2, 7)'.
1079 The extra two bytes are for a possible minus sign, and for the
1080 terminating null character.
1082 If the input number is an ordinary number, the exponent is written
1083 through the pointer EXPPTR (the current minimal exponent for 0).
1085 A pointer to the string is returned, unless there is an error, in
1086 which case a null pointer is returned.
1088 -- Function: void mpfr_free_str (char *STR)
1089 Free a string allocated by `mpfr_get_str' using the current
1090 unallocation function (preliminary interface). The block is
1091 assumed to be `strlen(STR)+1' bytes. For more information about
1092 how it is done: *note Custom Allocation: (gmp.info)Custom
1095 -- Function: int mpfr_fits_ulong_p (mpfr_t OP, mp_rnd_t RND)
1096 -- Function: int mpfr_fits_slong_p (mpfr_t OP, mp_rnd_t RND)
1097 -- Function: int mpfr_fits_uint_p (mpfr_t OP, mp_rnd_t RND)
1098 -- Function: int mpfr_fits_sint_p (mpfr_t OP, mp_rnd_t RND)
1099 -- Function: int mpfr_fits_ushort_p (mpfr_t OP, mp_rnd_t RND)
1100 -- Function: int mpfr_fits_sshort_p (mpfr_t OP, mp_rnd_t RND)
1101 -- Function: int mpfr_fits_intmax_p (mpfr_t OP, mp_rnd_t RND)
1102 -- Function: int mpfr_fits_uintmax_p (mpfr_t OP, mp_rnd_t RND)
1103 Return non-zero if OP would fit in the respective C data type, when
1104 rounded to an integer in the direction RND.
1107 File: mpfr.info, Node: Basic Arithmetic Functions, Next: Comparison Functions, Prev: Conversion Functions, Up: MPFR Interface
1109 5.5 Basic Arithmetic Functions
1110 ==============================
1112 -- Function: int mpfr_add (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
1114 -- Function: int mpfr_add_ui (mpfr_t ROP, mpfr_t OP1, unsigned long
1115 int OP2, mp_rnd_t RND)
1116 -- Function: int mpfr_add_si (mpfr_t ROP, mpfr_t OP1, long int OP2,
1118 -- Function: int mpfr_add_d (mpfr_t ROP, mpfr_t OP1, double OP2,
1120 -- Function: int mpfr_add_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2,
1122 -- Function: int mpfr_add_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
1124 Set ROP to OP1 + OP2 rounded in the direction RND. For types
1125 having no signed zero, it is considered unsigned (i.e. (+0) + 0 =
1126 (+0) and (-0) + 0 = (-0)). The `mpfr_add_d' function assumes that
1127 the radix of the `double' type is a power of 2, with a precision
1128 at most that declared by the C implementation (macro
1129 `IEEE_DBL_MANT_DIG', and if not defined 53 bits).
1131 -- Function: int mpfr_sub (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
1133 -- Function: int mpfr_ui_sub (mpfr_t ROP, unsigned long int OP1,
1134 mpfr_t OP2, mp_rnd_t RND)
1135 -- Function: int mpfr_sub_ui (mpfr_t ROP, mpfr_t OP1, unsigned long
1136 int OP2, mp_rnd_t RND)
1137 -- Function: int mpfr_si_sub (mpfr_t ROP, long int OP1, mpfr_t OP2,
1139 -- Function: int mpfr_sub_si (mpfr_t ROP, mpfr_t OP1, long int OP2,
1141 -- Function: int mpfr_d_sub (mpfr_t ROP, double OP1, mpfr_t OP2,
1143 -- Function: int mpfr_sub_d (mpfr_t ROP, mpfr_t OP1, double OP2,
1145 -- Function: int mpfr_sub_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2,
1147 -- Function: int mpfr_sub_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
1149 Set ROP to OP1 - OP2 rounded in the direction RND. For types
1150 having no signed zero, it is considered unsigned (i.e. (+0) - 0 =
1151 (+0), (-0) - 0 = (-0), 0 - (+0) = (-0) and 0 - (-0) = (+0)). The
1152 same restrictions than for `mpfr_add_d' apply to `mpfr_d_sub' and
1155 -- Function: int mpfr_mul (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
1157 -- Function: int mpfr_mul_ui (mpfr_t ROP, mpfr_t OP1, unsigned long
1158 int OP2, mp_rnd_t RND)
1159 -- Function: int mpfr_mul_si (mpfr_t ROP, mpfr_t OP1, long int OP2,
1161 -- Function: int mpfr_mul_d (mpfr_t ROP, mpfr_t OP1, double OP2,
1163 -- Function: int mpfr_mul_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2,
1165 -- Function: int mpfr_mul_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
1167 Set ROP to OP1 times OP2 rounded in the direction RND. When a
1168 result is zero, its sign is the product of the signs of the
1169 operands (for types having no signed zero, it is considered
1170 positive). The same restrictions than for `mpfr_add_d' apply to
1173 -- Function: int mpfr_sqr (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1174 Set ROP to the square of OP rounded in the direction RND.
1176 -- Function: int mpfr_div (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
1178 -- Function: int mpfr_ui_div (mpfr_t ROP, unsigned long int OP1,
1179 mpfr_t OP2, mp_rnd_t RND)
1180 -- Function: int mpfr_div_ui (mpfr_t ROP, mpfr_t OP1, unsigned long
1181 int OP2, mp_rnd_t RND)
1182 -- Function: int mpfr_si_div (mpfr_t ROP, long int OP1, mpfr_t OP2,
1184 -- Function: int mpfr_div_si (mpfr_t ROP, mpfr_t OP1, long int OP2,
1186 -- Function: int mpfr_d_div (mpfr_t ROP, double OP1, mpfr_t OP2,
1188 -- Function: int mpfr_div_d (mpfr_t ROP, mpfr_t OP1, double OP2,
1190 -- Function: int mpfr_div_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2,
1192 -- Function: int mpfr_div_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2,
1194 Set ROP to OP1/OP2 rounded in the direction RND. When a result is
1195 zero, its sign is the product of the signs of the operands (for
1196 types having no signed zero, it is considered positive). The same
1197 restrictions than for `mpfr_add_d' apply to `mpfr_d_div' and
1200 -- Function: int mpfr_sqrt (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1201 -- Function: int mpfr_sqrt_ui (mpfr_t ROP, unsigned long int OP,
1203 Set ROP to the square root of OP rounded in the direction RND.
1204 Return -0 if OP is -0 (to be consistent with the IEEE 754
1205 standard). Set ROP to NaN if OP is negative.
1207 -- Function: int mpfr_rec_sqrt (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1208 Set ROP to the reciprocal square root of OP rounded in the
1209 direction RND. Return +Inf if OP is ±0, and +0 if OP is +Inf. Set
1210 ROP to NaN if OP is negative.
1212 -- Function: int mpfr_cbrt (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1213 -- Function: int mpfr_root (mpfr_t ROP, mpfr_t OP, unsigned long int
1215 Set ROP to the cubic root (resp. the Kth root) of OP rounded in
1216 the direction RND. An odd (resp. even) root of a negative number
1217 (including -Inf) returns a negative number (resp. NaN). The Kth
1218 root of -0 is defined to be -0, whatever the parity of K.
1220 -- Function: int mpfr_pow (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
1222 -- Function: int mpfr_pow_ui (mpfr_t ROP, mpfr_t OP1, unsigned long
1223 int OP2, mp_rnd_t RND)
1224 -- Function: int mpfr_pow_si (mpfr_t ROP, mpfr_t OP1, long int OP2,
1226 -- Function: int mpfr_pow_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2,
1228 -- Function: int mpfr_ui_pow_ui (mpfr_t ROP, unsigned long int OP1,
1229 unsigned long int OP2, mp_rnd_t RND)
1230 -- Function: int mpfr_ui_pow (mpfr_t ROP, unsigned long int OP1,
1231 mpfr_t OP2, mp_rnd_t RND)
1232 Set ROP to OP1 raised to OP2, rounded in the direction RND.
1233 Special values are currently handled as described in the ISO C99
1234 standard for the `pow' function (note this may change in future
1236 * `pow(±0, Y)' returns plus or minus infinity for Y a negative
1239 * `pow(±0, Y)' returns plus infinity for Y negative and not an
1242 * `pow(±0, Y)' returns plus or minus zero for Y a positive odd
1245 * `pow(±0, Y)' returns plus zero for Y positive and not an odd
1248 * `pow(-1, ±Inf)' returns 1.
1250 * `pow(+1, Y)' returns 1 for any Y, even a NaN.
1252 * `pow(X, ±0)' returns 1 for any X, even a NaN.
1254 * `pow(X, Y)' returns NaN for finite negative X and finite
1257 * `pow(X, -Inf)' returns plus infinity for 0 < abs(x) < 1, and
1258 plus zero for abs(x) > 1.
1260 * `pow(X, +Inf)' returns plus zero for 0 < abs(x) < 1, and plus
1261 infinity for abs(x) > 1.
1263 * `pow(-Inf, Y)' returns minus zero for Y a negative odd
1266 * `pow(-Inf, Y)' returns plus zero for Y negative and not an
1269 * `pow(-Inf, Y)' returns minus infinity for Y a positive odd
1272 * `pow(-Inf, Y)' returns plus infinity for Y positive and not
1275 * `pow(+Inf, Y)' returns plus zero for Y negative, and plus
1276 infinity for Y positive.
1278 -- Function: int mpfr_neg (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1279 Set ROP to -OP rounded in the direction RND. Just changes the
1280 sign if ROP and OP are the same variable.
1282 -- Function: int mpfr_abs (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1283 Set ROP to the absolute value of OP, rounded in the direction RND.
1284 Just changes the sign if ROP and OP are the same variable.
1286 -- Function: int mpfr_dim (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
1288 Set ROP to the positive difference of OP1 and OP2, i.e., OP1 - OP2
1289 rounded in the direction RND if OP1 > OP2, and +0 otherwise.
1290 Returns NaN when OP1 or OP2 is NaN.
1292 -- Function: int mpfr_mul_2ui (mpfr_t ROP, mpfr_t OP1, unsigned long
1293 int OP2, mp_rnd_t RND)
1294 -- Function: int mpfr_mul_2si (mpfr_t ROP, mpfr_t OP1, long int OP2,
1296 Set ROP to OP1 times 2 raised to OP2 rounded in the direction RND.
1297 Just increases the exponent by OP2 when ROP and OP1 are identical.
1299 -- Function: int mpfr_div_2ui (mpfr_t ROP, mpfr_t OP1, unsigned long
1300 int OP2, mp_rnd_t RND)
1301 -- Function: int mpfr_div_2si (mpfr_t ROP, mpfr_t OP1, long int OP2,
1303 Set ROP to OP1 divided by 2 raised to OP2 rounded in the direction
1304 RND. Just decreases the exponent by OP2 when ROP and OP1 are
1308 File: mpfr.info, Node: Comparison Functions, Next: Special Functions, Prev: Basic Arithmetic Functions, Up: MPFR Interface
1310 5.6 Comparison Functions
1311 ========================
1313 -- Function: int mpfr_cmp (mpfr_t OP1, mpfr_t OP2)
1314 -- Function: int mpfr_cmp_ui (mpfr_t OP1, unsigned long int OP2)
1315 -- Function: int mpfr_cmp_si (mpfr_t OP1, signed long int OP2)
1316 -- Function: int mpfr_cmp_d (mpfr_t OP1, double OP2)
1317 -- Function: int mpfr_cmp_ld (mpfr_t OP1, long double OP2)
1318 -- Function: int mpfr_cmp_z (mpfr_t OP1, mpz_t OP2)
1319 -- Function: int mpfr_cmp_q (mpfr_t OP1, mpq_t OP2)
1320 -- Function: int mpfr_cmp_f (mpfr_t OP1, mpf_t OP2)
1321 Compare OP1 and OP2. Return a positive value if OP1 > OP2, zero
1322 if OP1 = OP2, and a negative value if OP1 < OP2. Both OP1 and OP2
1323 are considered to their full own precision, which may differ. If
1324 one of the operands is NaN, set the _erange_ flag and return zero.
1326 Note: These functions may be useful to distinguish the three
1327 possible cases. If you need to distinguish two cases only, it is
1328 recommended to use the predicate functions (e.g., `mpfr_equal_p'
1329 for the equality) described below; they behave like the IEEE 754
1330 comparisons, in particular when one or both arguments are NaN. But
1331 only floating-point numbers can be compared (you may need to do a
1334 -- Function: int mpfr_cmp_ui_2exp (mpfr_t OP1, unsigned long int OP2,
1336 -- Function: int mpfr_cmp_si_2exp (mpfr_t OP1, long int OP2, mp_exp_t
1338 Compare OP1 and OP2 multiplied by two to the power E. Similar as
1341 -- Function: int mpfr_cmpabs (mpfr_t OP1, mpfr_t OP2)
1342 Compare |OP1| and |OP2|. Return a positive value if |OP1| >
1343 |OP2|, zero if |OP1| = |OP2|, and a negative value if |OP1| <
1344 |OP2|. If one of the operands is NaN, set the _erange_ flag and
1347 -- Function: int mpfr_nan_p (mpfr_t OP)
1348 -- Function: int mpfr_inf_p (mpfr_t OP)
1349 -- Function: int mpfr_number_p (mpfr_t OP)
1350 -- Function: int mpfr_zero_p (mpfr_t OP)
1351 Return non-zero if OP is respectively NaN, an infinity, an ordinary
1352 number (i.e. neither NaN nor an infinity) or zero. Return zero
1355 -- Macro: int mpfr_sgn (mpfr_t OP)
1356 Return a positive value if OP > 0, zero if OP = 0, and a negative
1357 value if OP < 0. If the operand is NaN, set the _erange_ flag and
1360 -- Function: int mpfr_greater_p (mpfr_t OP1, mpfr_t OP2)
1361 Return non-zero if OP1 > OP2, zero otherwise.
1363 -- Function: int mpfr_greaterequal_p (mpfr_t OP1, mpfr_t OP2)
1364 Return non-zero if OP1 >= OP2, zero otherwise.
1366 -- Function: int mpfr_less_p (mpfr_t OP1, mpfr_t OP2)
1367 Return non-zero if OP1 < OP2, zero otherwise.
1369 -- Function: int mpfr_lessequal_p (mpfr_t OP1, mpfr_t OP2)
1370 Return non-zero if OP1 <= OP2, zero otherwise.
1372 -- Function: int mpfr_lessgreater_p (mpfr_t OP1, mpfr_t OP2)
1373 Return non-zero if OP1 < OP2 or OP1 > OP2 (i.e. neither OP1, nor
1374 OP2 is NaN, and OP1 <> OP2), zero otherwise (i.e. OP1 and/or OP2
1375 are NaN, or OP1 = OP2).
1377 -- Function: int mpfr_equal_p (mpfr_t OP1, mpfr_t OP2)
1378 Return non-zero if OP1 = OP2, zero otherwise (i.e. OP1 and/or OP2
1379 are NaN, or OP1 <> OP2).
1381 -- Function: int mpfr_unordered_p (mpfr_t OP1, mpfr_t OP2)
1382 Return non-zero if OP1 or OP2 is a NaN (i.e. they cannot be
1383 compared), zero otherwise.
1386 File: mpfr.info, Node: Special Functions, Next: Input and Output Functions, Prev: Comparison Functions, Up: MPFR Interface
1388 5.7 Special Functions
1389 =====================
1391 All those functions, except explicitly stated, return zero for an exact
1392 return value, a positive value for a return value larger than the exact
1393 result, and a negative value otherwise.
1395 Important note: in some domains, computing special functions (either
1396 with correct or incorrect rounding) is expensive, even for small
1397 precision, for example the trigonometric and Bessel functions for large
1400 -- Function: int mpfr_log (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1401 -- Function: int mpfr_log2 (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1402 -- Function: int mpfr_log10 (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1403 Set ROP to the natural logarithm of OP, log2(OP) or log10(OP),
1404 respectively, rounded in the direction RND. Return -Inf if OP is
1405 -0 (i.e. the sign of the zero has no influence on the result).
1407 -- Function: int mpfr_exp (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1408 -- Function: int mpfr_exp2 (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1409 -- Function: int mpfr_exp10 (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1410 Set ROP to the exponential of OP, to 2 power of OP or to 10 power
1411 of OP, respectively, rounded in the direction RND.
1413 -- Function: int mpfr_cos (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1414 -- Function: int mpfr_sin (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1415 -- Function: int mpfr_tan (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1416 Set ROP to the cosine of OP, sine of OP, tangent of OP, rounded in
1419 -- Function: int mpfr_sec (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1420 -- Function: int mpfr_csc (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1421 -- Function: int mpfr_cot (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1422 Set ROP to the secant of OP, cosecant of OP, cotangent of OP,
1423 rounded in the direction RND.
1425 -- Function: int mpfr_sin_cos (mpfr_t SOP, mpfr_t COP, mpfr_t OP,
1427 Set simultaneously SOP to the sine of OP and
1428 COP to the cosine of OP, rounded in the direction RND with the
1429 corresponding precisions of SOP and COP, which must be different
1430 variables. Return 0 iff both results are exact.
1432 -- Function: int mpfr_acos (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1433 -- Function: int mpfr_asin (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1434 -- Function: int mpfr_atan (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1435 Set ROP to the arc-cosine, arc-sine or arc-tangent of OP, rounded
1436 in the direction RND. Note that since `acos(-1)' returns the
1437 floating-point number closest to Pi according to the given
1438 rounding mode, this number might not be in the output range 0 <=
1439 ROP < \pi of the arc-cosine function; still, the result lies in
1440 the image of the output range by the rounding function. The same
1441 holds for `asin(-1)', `asin(1)', `atan(-Inf)', `atan(+Inf)'.
1443 -- Function: int mpfr_atan2 (mpfr_t ROP, mpfr_t Y, mpfr_t X, mp_rnd_t
1445 Set ROP to the arc-tangent2 of Y and X, rounded in the direction
1446 RND: if `x > 0', `atan2(y, x) = atan (y/x)'; if `x < 0', `atan2(y,
1447 x) = sign(y)*(Pi - atan (abs(y/x)))'. As for `atan', in case the
1448 exact mathematical result is +Pi or -Pi, its rounded result might
1449 be outside the function output range.
1451 `atan2(y, 0)' does not raise any floating-point exception.
1452 Special values are currently handled as described in the ISO C99
1453 standard for the `atan2' function (note this may change in future
1455 * `atan2(+0, -0)' returns +Pi.
1457 * `atan2(-0, -0)' returns -Pi.
1459 * `atan2(+0, +0)' returns +0.
1461 * `atan2(-0, +0)' returns -0.
1463 * `atan2(+0, x)' returns +Pi for x < 0.
1465 * `atan2(-0, x)' returns -Pi for x < 0.
1467 * `atan2(+0, x)' returns +0 for x > 0.
1469 * `atan2(-0, x)' returns -0 for x > 0.
1471 * `atan2(y, 0)' returns -Pi/2 for y < 0.
1473 * `atan2(y, 0)' returns +Pi/2 for y > 0.
1475 * `atan2(+Inf, -Inf)' returns +3*Pi/4.
1477 * `atan2(-Inf, -Inf)' returns -3*Pi/4.
1479 * `atan2(+Inf, +Inf)' returns +Pi/4.
1481 * `atan2(-Inf, +Inf)' returns -Pi/4.
1483 * `atan2(+Inf, x)' returns +Pi/2 for finite x.
1485 * `atan2(-Inf, x)' returns -Pi/2 for finite x.
1487 * `atan2(y, -Inf)' returns +Pi for finite y > 0.
1489 * `atan2(y, -Inf)' returns -Pi for finite y < 0.
1491 * `atan2(y, +Inf)' returns +0 for finite y > 0.
1493 * `atan2(y, +Inf)' returns -0 for finite y < 0.
1495 -- Function: int mpfr_cosh (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1496 -- Function: int mpfr_sinh (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1497 -- Function: int mpfr_tanh (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1498 Set ROP to the hyperbolic cosine, sine or tangent of OP, rounded
1499 in the direction RND.
1501 -- Function: int mpfr_sinh_cosh (mpfr_t SOP, mpfr_t COP, mpfr_t OP,
1503 Set simultaneously SOP to the hyperbolic sine of OP and
1504 COP to the hyperbolic cosine of OP, rounded in the
1505 direction RND with the corresponding precision of SOP and COP
1506 which must be different variables. Return 0 iff both results are
1509 -- Function: int mpfr_sech (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1510 -- Function: int mpfr_csch (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1511 -- Function: int mpfr_coth (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1512 Set ROP to the hyperbolic secant of OP, cosecant of OP, cotangent
1513 of OP, rounded in the direction RND.
1515 -- Function: int mpfr_acosh (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1516 -- Function: int mpfr_asinh (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1517 -- Function: int mpfr_atanh (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1518 Set ROP to the inverse hyperbolic cosine, sine or tangent of OP,
1519 rounded in the direction RND.
1521 -- Function: int mpfr_fac_ui (mpfr_t ROP, unsigned long int OP,
1523 Set ROP to the factorial of the `unsigned long int' OP, rounded in
1526 -- Function: int mpfr_log1p (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1527 Set ROP to the logarithm of one plus OP, rounded in the direction
1530 -- Function: int mpfr_expm1 (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1531 Set ROP to the exponential of OP minus one, rounded in the
1534 -- Function: int mpfr_eint (mpfr_t Y, mpfr_t X, mp_rnd_t RND)
1535 Set Y to the exponential integral of X, rounded in the direction
1536 RND. For positive X, the exponential integral is the sum of
1537 Euler's constant, of the logarithm of X, and of the sum for k from
1538 1 to infinity of X to the power k, divided by k and factorial(k).
1539 For negative X, the returned value is NaN.
1541 -- Function: int mpfr_li2 (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND_MODE)
1542 Set ROP to real part of the dilogarithm of OP, rounded in the
1543 direction RND_MODE. The dilogarithm function is defined here as
1544 the integral of -log(1-t)/t from 0 to x.
1546 -- Function: int mpfr_gamma (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1547 Set ROP to the value of the Gamma function on OP, rounded in the
1548 direction RND. When OP is a negative integer, NaN is returned.
1550 -- Function: int mpfr_lngamma (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1551 Set ROP to the value of the logarithm of the Gamma function on OP,
1552 rounded in the direction RND. When -2K-1 <= X <= -2K, K being a
1553 non-negative integer, NaN is returned. See also `mpfr_lgamma'.
1555 -- Function: int mpfr_lgamma (mpfr_t ROP, int *SIGNP, mpfr_t OP,
1557 Set ROP to the value of the logarithm of the absolute value of the
1558 Gamma function on OP, rounded in the direction RND. The sign (1 or
1559 -1) of Gamma(OP) is returned in the object pointed to by SIGNP.
1560 When OP is an infinity or a non-positive integer, +Inf is
1561 returned. When OP is NaN, -Inf or a negative integer, *SIGNP is
1562 undefined, and when OP is ±0, *SIGNP is the sign of the zero.
1564 -- Function: int mpfr_zeta (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1565 -- Function: int mpfr_zeta_ui (mpfr_t ROP, unsigned long OP, mp_rnd_t
1567 Set ROP to the value of the Riemann Zeta function on OP, rounded
1568 in the direction RND.
1570 -- Function: int mpfr_erf (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1571 Set ROP to the value of the error function on OP, rounded in the
1574 -- Function: int mpfr_erfc (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1575 Set ROP to the value of the complementary error function on OP,
1576 rounded in the direction RND.
1578 -- Function: int mpfr_j0 (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1579 -- Function: int mpfr_j1 (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1580 -- Function: int mpfr_jn (mpfr_t ROP, long N, mpfr_t OP, mp_rnd_t RND)
1581 Set ROP to the value of the first kind Bessel function of order 0,
1582 1 and N on OP, rounded in the direction RND. When OP is NaN, ROP
1583 is always set to NaN. When OP is plus or minus Infinity, ROP is
1584 set to +0. When OP is zero, and N is not zero, ROP is +0 or -0
1585 depending on the parity and sign of N, and the sign of OP.
1587 -- Function: int mpfr_y0 (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1588 -- Function: int mpfr_y1 (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1589 -- Function: int mpfr_yn (mpfr_t ROP, long N, mpfr_t OP, mp_rnd_t RND)
1590 Set ROP to the value of the second kind Bessel function of order
1591 0, 1 and N on OP, rounded in the direction RND. When OP is NaN or
1592 negative, ROP is always set to NaN. When OP is +Inf, ROP is +0.
1593 When OP is zero, ROP is +Inf or -Inf depending on the parity and
1596 -- Function: int mpfr_fma (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_t
1598 Set ROP to (OP1 times OP2) + OP3, rounded in the direction RND.
1600 -- Function: int mpfr_fms (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_t
1602 Set ROP to (OP1 times OP2) - OP3, rounded in the direction RND.
1604 -- Function: int mpfr_agm (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
1606 Set ROP to the arithmetic-geometric mean of OP1 and OP2, rounded
1607 in the direction RND. The arithmetic-geometric mean is the common
1608 limit of the sequences u[n] and v[n], where u[0]=OP1, v[0]=OP2,
1609 u[n+1] is the arithmetic mean of u[n] and v[n], and v[n+1] is the
1610 geometric mean of u[n] and v[n]. If any operand is negative, the
1611 return value is NaN.
1613 -- Function: int mpfr_hypot (mpfr_t ROP, mpfr_t X, mpfr_t Y, mp_rnd_t
1615 Set ROP to the Euclidean norm of X and Y, i.e. the square root of
1616 the sum of the squares of X and Y, rounded in the direction RND.
1617 Special values are currently handled as described in Section
1618 F.9.4.3 of the ISO C99 standard, for the `hypot' function (note
1619 this may change in future versions): If X or Y is an infinity,
1620 then plus infinity is returned in ROP, even if the other number is
1623 -- Function: int mpfr_const_log2 (mpfr_t ROP, mp_rnd_t RND)
1624 -- Function: int mpfr_const_pi (mpfr_t ROP, mp_rnd_t RND)
1625 -- Function: int mpfr_const_euler (mpfr_t ROP, mp_rnd_t RND)
1626 -- Function: int mpfr_const_catalan (mpfr_t ROP, mp_rnd_t RND)
1627 Set ROP to the logarithm of 2, the value of Pi, of Euler's
1628 constant 0.577..., of Catalan's constant 0.915..., respectively,
1629 rounded in the direction RND. These functions cache the computed
1630 values to avoid other calculations if a lower or equal precision
1631 is requested. To free these caches, use `mpfr_free_cache'.
1633 -- Function: void mpfr_free_cache (void)
1634 Free various caches used by MPFR internally, in particular the
1635 caches used by the functions computing constants (currently
1636 `mpfr_const_log2', `mpfr_const_pi', `mpfr_const_euler' and
1637 `mpfr_const_catalan'). You should call this function before
1638 terminating a thread, even if you did not call these functions
1639 directly (they could have been called internally).
1641 -- Function: int mpfr_sum (mpfr_t ROP, mpfr_ptr const TAB[], unsigned
1642 long N, mp_rnd_t RND)
1643 Set ROP to the sum of all elements of TAB, whose size is N,
1644 rounded in the direction RND. Warning, TAB is a table of pointers
1645 to mpfr_t, not a table of mpfr_t (preliminary interface). If the
1646 returned `int' value is zero, ROP is guaranteed to be the exact
1647 sum; otherwise ROP might be smaller than, equal to, or larger than
1648 the exact sum (in accordance to the rounding mode). However,
1649 `mpfr_sum' does guarantee the result is correctly rounded.
1652 File: mpfr.info, Node: Input and Output Functions, Next: Formatted Output Functions, Prev: Special Functions, Up: MPFR Interface
1654 5.8 Input and Output Functions
1655 ==============================
1657 This section describes functions that perform input from an input/output
1658 stream, and functions that output to an input/output stream. Passing a
1659 null pointer for a `stream' to any of these functions will make them
1660 read from `stdin' and write to `stdout', respectively.
1662 When using any of these functions, you must include the `<stdio.h>'
1663 standard header before `mpfr.h', to allow `mpfr.h' to define prototypes
1664 for these functions.
1666 -- Function: size_t mpfr_out_str (FILE *STREAM, int BASE, size_t N,
1667 mpfr_t OP, mp_rnd_t RND)
1668 Output OP on stream STREAM, as a string of digits in base BASE,
1669 rounded in the direction RND. The base may vary from 2 to 36.
1670 Print N significant digits exactly, or if N is 0, enough digits so
1671 that OP can be read back exactly (see `mpfr_get_str').
1673 In addition to the significant digits, a decimal point (defined by
1674 the current locale) at the right of the first digit and a trailing
1675 exponent in base 10, in the form `eNNN', are printed. If BASE is
1676 greater than 10, `@' will be used instead of `e' as exponent
1679 Return the number of bytes written, or if an error occurred,
1682 -- Function: size_t mpfr_inp_str (mpfr_t ROP, FILE *STREAM, int BASE,
1684 Input a string in base BASE from stream STREAM, rounded in the
1685 direction RND, and put the read float in ROP.
1687 This function reads a word (defined as a sequence of characters
1688 between whitespace) and parses it using `mpfr_set_str' (it may
1689 change). See the documentation of `mpfr_strtofr' for a detailed
1690 description of the valid string formats.
1692 Return the number of bytes read, or if an error occurred, return 0.
1695 File: mpfr.info, Node: Formatted Output Functions, Next: Integer Related Functions, Prev: Input and Output Functions, Up: MPFR Interface
1697 5.9 Formatted Output Functions
1698 ==============================
1703 The class of `mpfr_printf' functions provides formatted output in a
1704 similar manner as the standard C `printf'. These functions are defined
1705 only if your system supports ISO C variadic functions and the
1706 corresponding argument access macros.
1708 When using any of these functions, you must include the `<stdio.h>'
1709 standard header before `mpfr.h', to allow `mpfr.h' to define prototypes
1710 for these functions.
1715 The format specification accepted by `mpfr_printf' is an extension of
1716 the `printf' one. The conversion specification is of the form:
1717 % [flags] [width] [.[precision]] [type] [rounding] conv
1718 `flags', `width', and `precision' have the same meaning as for the
1719 standard `printf' (in particular, notice that the `precision' is
1720 related to the number of digits displayed in the base chosen by `conv'
1721 and not related to the internal precision of the `mpfr_t' variable).
1722 `mpfr_printf' accepts the same `type' specifiers as GMP (except the
1723 non-standard and deprecated `q', use `ll' instead), plus `R' and `P':
1727 `j' `intmax_t' or `uintmax_t'
1728 `l' `long' or `wchar_t'
1733 `F' `mpf_t', float conversions
1734 `Q' `mpq_t', integer conversions
1735 `M' `mp_limb_t', integer conversions
1736 `N' `mp_limb_t' array, integer conversions
1737 `Z' `mpz_t', integer conversions
1738 `P' `mp_prec_t', integer conversions
1739 `R' `mpfr_t', float conversions
1741 The `type' specifiers have the same restrictions as those mentioned
1742 in the GMP documentation: *note Formatted Output Strings:
1743 (gmp.info)Formatted Output Strings. In particular, the `type'
1744 specifiers (except `R' and `P' defined by MPFR) are supported only if
1745 they are supported by `gmp_printf' in your GMP build; this implies that
1746 the standard specifiers, such as `t', must _also_ be supported by your
1747 C library if you want to use them.
1749 The `rounding' field is specific to `mpfr_t' arguments and should
1750 not be used with other types.
1752 With conversion specification not involving `P' and `R' types,
1753 `mpfr_printf' behaves exactly as `gmp_printf'.
1755 The `P' type specifies that a following `o', `u', `x', or `X'
1756 conversion specifier applies to a `mp_prec_t' argument. It is needed
1757 because the `mp_prec_t' type does not necessarily correspond to an
1758 `unsigned int' or any fixed standard type. The `precision' field
1759 specifies the minimum number of digits to appear. The default
1760 `precision' is 1. For example:
1765 p = mpfr_get_prec (x);
1766 mpfr_printf ("variable x with %Pu bits", p);
1768 The `R' type specifies that a following `a', `A', `b', `e', `E',
1769 `f', `F', `g', `G', or `n' conversion specifier applies to a `mpfr_t'
1770 argument. The `R' type can be followed by a `rounding' specifier
1771 denoted by one of the following characters:
1773 `U' round toward plus infinity
1774 `D' round toward minus infinity
1775 `Z' round toward zero
1776 `N' round to nearest
1777 `*' rounding mode indicated by the
1778 `mp_rnd_t' argument just before the
1779 corresponding `mpfr_t' variable.
1781 The default rounding mode is rounding to nearest. The following
1782 three examples are equivalent:
1786 mpfr_printf ("%.128Rf", x);
1787 mpfr_printf ("%.128RNf", x);
1788 mpfr_printf ("%.128R*f", GMP_RNDN, x);
1790 The output `conv' specifiers allowed with `mpfr_t' parameter are:
1792 `a' `A' hex float, C99 style
1794 `e' `E' scientific format float
1795 `f' `F' fixed point float
1796 `g' `G' fixed or scientific float
1798 The conversion specifier `b' which displays the argument in binary is
1799 specific to `mpfr_t' arguments and should not be used with other types.
1800 Other conversion specifiers have the same meaning as for a `double'
1803 In case of non-decimal output, only the significand is written in the
1804 specified base, the exponent is always displayed in decimal. Special
1805 values are always displayed as `nan', `-inf', and `inf' for `a', `b',
1806 `e', `f', and `g' specifiers and `NAN', `-INF', and `INF' for `A', `E',
1807 `F', and `G' specifiers.
1809 If the `precision' field is not empty, the `mpfr_t' number is
1810 rounded to the given precision in the direction specified by the
1811 rounding mode. If the precision is zero with rounding to nearest mode
1812 and one of the following `conv' specifier: `a', `A', `b', `e', `E', tie
1813 case is rounded to even when it lies between two values at the wanted
1814 precision which have the same exponent, otherwise, it is rounded away
1815 from zero. For instance, 85 is displayed as "8e+1" and 95 is displayed
1816 as "1e+2" with the format specification `"%.0RNe"'. This also applies
1817 when the `g' (resp. `G') conversion specifier uses the `e' (resp. `E')
1818 style. If the precision is set to a value greater than the maximum
1819 value for an `int', it will be silently reduced down to `INT_MAX'.
1821 If the `precision' field is empty (as in `%Re' or `%.Re') with
1822 `conv' specifier `e' and `E', the number is displayed with enough
1823 digits so that it can be read back exactly, assuming that the input and
1824 output variables have the same precision and that the input and output
1825 rounding modes are both rounding to nearest (as for `mpfr_get_str').
1826 The default precision for an empty `precision' field with `conv'
1827 specifiers `f', `F', `g', and `G' is 6.
1832 -- Function: int mpfr_fprintf (FILE *STREAM, const char *TEMPLATE, ...)
1833 -- Function: int mpfr_vfprintf (FILE *STREAM, const char *TEMPLATE,
1835 Print to the stream STREAM the optional arguments under the
1836 control of the template string TEMPLATE.
1838 Return the number of characters written or a negative value if an
1839 error occurred. If the number of characters which ought to be
1840 written appears to exceed the maximum limit for an `int', nothing
1841 is written in the stream, the function returns -1, sets the
1842 _erange_ flag, and (in POSIX system only) `errno' is set to
1845 -- Function: int mpfr_printf (const char *TEMPLATE, ...)
1846 -- Function: int mpfr_vprintf (const char *TEMPLATE, va_list AP)
1847 Print to `stdout' the optional arguments under the control of the
1848 template string TEMPLATE.
1850 Return the number of characters written or a negative value if an
1851 error occurred. If the number of characters which ought to be
1852 written appears to exceed the maximum limit for an `int', nothing
1853 is written in `stdout', the function returns -1, sets the _erange_
1854 flag, and (in POSIX system only) `errno' is set to `EOVERFLOW'.
1856 -- Function: int mpfr_sprintf (char *BUF, const char *TEMPLATE, ...)
1857 -- Function: int mpfr_vsprintf (char *BUF, const char *TEMPLATE,
1859 Form a null-terminated string in BUF. No overlap is permitted
1860 between BUF and the other arguments.
1862 Return the number of characters written in the array BUF not
1863 counting the terminating null character or a negative value if an
1864 error occurred. If the number of characters which ought to be
1865 written appears to exceed the maximum limit for an `int', nothing
1866 is written in BUF, the function returns -1, sets the _erange_
1867 flag, and (in POSIX system only) `errno' is set to `EOVERFLOW'.
1869 -- Function: int mpfr_snprintf (char *BUF, size_t N, const char
1871 -- Function: int mpfr_vsnprintf (char *BUF, size_t N, const char
1872 *TEMPLATE, va_list AP)
1873 Form a null-terminated string in BUF. If N is zero, nothing is
1874 written and BUF may be a null pointer, otherwise, the `n-1' first
1875 characters are written in BUF and the N-th is a null character.
1877 Return the number of characters that would have been written had N
1878 be sufficiently large, not counting the terminating null character
1879 or a negative value if an error occurred. If the number of
1880 characters produced by the optional arguments under the control of
1881 the template string TEMPLATE appears to exceed the maximum limit
1882 for an `int', nothing is written in BUF, the function returns -1,
1883 sets the _erange_ flag, and (in POSIX system only) `errno' is set
1886 -- Function: int mpfr_asprintf (char **STR, const char *TEMPLATE, ...)
1887 -- Function: int mpfr_vasprintf (char **STR, const char *TEMPLATE,
1889 Write their output as a null terminated string in a block of
1890 memory allocated using the current allocation function. A pointer
1891 to the block is stored in STR. The block of memory must be freed
1892 using `mpfr_free_str'.
1894 The return value is the number of characters written in the
1895 string, excluding the null-terminator or a negative value if an
1896 error occurred. If the number of characters produced by the
1897 optional arguments under the control of the template string
1898 TEMPLATE appears to exceed the maximum limit for an `int', STR is
1899 a null pointer, the function returns -1, sets the _erange_ flag,
1900 and (in POSIX system only) `errno' is set to `EOVERFLOW'.
1903 File: mpfr.info, Node: Integer Related Functions, Next: Rounding Related Functions, Prev: Formatted Output Functions, Up: MPFR Interface
1905 5.10 Integer and Remainder Related Functions
1906 ============================================
1908 -- Function: int mpfr_rint (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1909 -- Function: int mpfr_ceil (mpfr_t ROP, mpfr_t OP)
1910 -- Function: int mpfr_floor (mpfr_t ROP, mpfr_t OP)
1911 -- Function: int mpfr_round (mpfr_t ROP, mpfr_t OP)
1912 -- Function: int mpfr_trunc (mpfr_t ROP, mpfr_t OP)
1913 Set ROP to OP rounded to an integer. `mpfr_rint' rounds to the
1914 nearest representable integer in the given rounding mode,
1915 `mpfr_ceil' rounds to the next higher or equal representable
1916 integer, `mpfr_floor' to the next lower or equal representable
1917 integer, `mpfr_round' to the nearest representable integer,
1918 rounding halfway cases away from zero (as in the roundTiesToAway
1919 mode of IEEE 754-2008), and `mpfr_trunc' to the next representable
1920 integer toward zero.
1922 The returned value is zero when the result is exact, positive when
1923 it is greater than the original value of OP, and negative when it
1924 is smaller. More precisely, the returned value is 0 when OP is an
1925 integer representable in ROP, 1 or -1 when OP is an integer that
1926 is not representable in ROP, 2 or -2 when OP is not an integer.
1928 Note that `mpfr_round' is different from `mpfr_rint' called with
1929 the rounding to nearest mode (where halfway cases are rounded to
1930 an even integer or significand). Note also that no double rounding
1931 is performed; for instance, 4.5 (100.1 in binary) is rounded by
1932 `mpfr_round' to 4 (100 in binary) in 2-bit precision, though
1933 `round(4.5)' is equal to 5 and 5 (101 in binary) is rounded to 6
1934 (110 in binary) in 2-bit precision.
1936 -- Function: int mpfr_rint_ceil (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1937 -- Function: int mpfr_rint_floor (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1938 -- Function: int mpfr_rint_round (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1939 -- Function: int mpfr_rint_trunc (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1940 Set ROP to OP rounded to an integer. `mpfr_rint_ceil' rounds to
1941 the next higher or equal integer, `mpfr_rint_floor' to the next
1942 lower or equal integer, `mpfr_rint_round' to the nearest integer,
1943 rounding halfway cases away from zero, and `mpfr_rint_trunc' to
1944 the next integer toward zero. If the result is not representable,
1945 it is rounded in the direction RND. The returned value is the
1946 ternary value associated with the considered round-to-integer
1947 function (regarded in the same way as any other mathematical
1950 -- Function: int mpfr_frac (mpfr_t ROP, mpfr_t OP, mp_rnd_t RND)
1951 Set ROP to the fractional part of OP, having the same sign as OP,
1952 rounded in the direction RND (unlike in `mpfr_rint', RND affects
1953 only how the exact fractional part is rounded, not how the
1954 fractional part is generated).
1956 -- Function: int mpfr_modf (mpfr_t IOP, mpfr_t FOP, mpfr_t OP,
1958 Set simultaneously IOP to the integral part of OP and FOP to the
1959 fractional part of OP, rounded in the direction RND with the
1960 corresponding precision of IOP and FOP (equivalent to
1961 `mpfr_trunc(IOP, OP, RND)' and `mpfr_frac(FOP, OP, RND)'). The
1962 variables IOP and FOP must be different. Return 0 iff both results
1965 -- Function: int mpfr_fmod (mpfr_t R, mpfr_t X, mpfr_t Y, mp_rnd_t RND)
1966 -- Function: int mpfr_remainder (mpfr_t R, mpfr_t X, mpfr_t Y,
1968 -- Function: int mpfr_remquo (mpfr_t R, long* Q, mpfr_t X, mpfr_t Y,
1970 Set R to the value of x - n y, rounded according to the direction
1971 RND, where n is the integer quotient of X divided by Y, defined as
1972 follows: n is rounded toward zero for `mpfr_fmod', and to the
1973 nearest integer (ties rounded to even) for `mpfr_remainder' and
1976 Special values are handled as described in Section F.9.7.1 of the
1977 ISO C99 standard: If X is infinite or Y is zero, R is NaN. If Y
1978 is infinite and X is finite, R is X rounded to the precision of R.
1979 If R is zero, it has the sign of X. The return value is the
1980 ternary value corresponding to R.
1982 Additionally, `mpfr_remquo' stores the low significant bits from
1983 the quotient in *Q (more precisely the number of bits in a `long'
1984 minus one), with the sign of X divided by Y (except if those low
1985 bits are all zero, in which case zero is returned). Note that X
1986 may be so large in magnitude relative to Y that an exact
1987 representation of the quotient is not practical. `mpfr_remainder'
1988 and `mpfr_remquo' functions are useful for additive argument
1991 -- Function: int mpfr_integer_p (mpfr_t OP)
1992 Return non-zero iff OP is an integer.
1995 File: mpfr.info, Node: Rounding Related Functions, Next: Miscellaneous Functions, Prev: Integer Related Functions, Up: MPFR Interface
1997 5.11 Rounding Related Functions
1998 ===============================
2000 -- Function: void mpfr_set_default_rounding_mode (mp_rnd_t RND)
2001 Set the default rounding mode to RND. The default rounding mode
2002 is to nearest initially.
2004 -- Function: mp_rnd_t mpfr_get_default_rounding_mode (void)
2005 Get the default rounding mode.
2007 -- Function: int mpfr_prec_round (mpfr_t X, mp_prec_t PREC, mp_rnd_t
2009 Round X according to RND with precision PREC, which must be an
2010 integer between `MPFR_PREC_MIN' and `MPFR_PREC_MAX' (otherwise the
2011 behavior is undefined). If PREC is greater or equal to the
2012 precision of X, then new space is allocated for the significand,
2013 and it is filled with zeros. Otherwise, the significand is
2014 rounded to precision PREC with the given direction. In both cases,
2015 the precision of X is changed to PREC.
2017 -- Function: int mpfr_round_prec (mpfr_t X, mp_rnd_t RND, mp_prec_t
2019 [This function is obsolete. Please use `mpfr_prec_round' instead.]
2021 -- Function: int mpfr_can_round (mpfr_t B, mp_exp_t ERR, mp_rnd_t
2022 RND1, mp_rnd_t RND2, mp_prec_t PREC)
2023 Assuming B is an approximation of an unknown number X in the
2024 direction RND1 with error at most two to the power E(b)-ERR where
2025 E(b) is the exponent of B, return a non-zero value if one is able
2026 to round correctly X to precision PREC with the direction RND2,
2027 and 0 otherwise (including for NaN and Inf). This function *does
2028 not modify* its arguments.
2030 Note: if one wants to also determine the correct ternary value
2031 when rounding B to precision PREC, a useful trick is the following: if (mpfr_can_round (b, err, rnd1, GMP_RNDZ, prec + (rnd2 == GMP_RNDN)))
2033 Indeed, if RND2 is `GMP_RNDN', this will check if one can round
2034 to PREC+1 bits with a directed rounding: if so, one can surely
2035 round to nearest to PREC bits, and in addition one can determine
2036 the correct ternary value, which would not be the case when B is
2037 near from a value exactly representable on PREC bits.
2039 -- Function: const char * mpfr_print_rnd_mode (mp_rnd_t RND)
2040 Return the input string (GMP_RNDD, GMP_RNDU, GMP_RNDN, GMP_RNDZ)
2041 corresponding to the rounding mode RND or a null pointer if RND is
2042 an invalid rounding mode.
2045 File: mpfr.info, Node: Miscellaneous Functions, Next: Exception Related Functions, Prev: Rounding Related Functions, Up: MPFR Interface
2047 5.12 Miscellaneous Functions
2048 ============================
2050 -- Function: void mpfr_nexttoward (mpfr_t X, mpfr_t Y)
2051 If X or Y is NaN, set X to NaN. Otherwise, if X is different from
2052 Y, replace X by the next floating-point number (with the precision
2053 of X and the current exponent range) in the direction of Y, if
2054 there is one (the infinite values are seen as the smallest and
2055 largest floating-point numbers). If the result is zero, it keeps
2056 the same sign. No underflow or overflow is generated.
2058 -- Function: void mpfr_nextabove (mpfr_t X)
2059 Equivalent to `mpfr_nexttoward' where Y is plus infinity.
2061 -- Function: void mpfr_nextbelow (mpfr_t X)
2062 Equivalent to `mpfr_nexttoward' where Y is minus infinity.
2064 -- Function: int mpfr_min (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
2066 Set ROP to the minimum of OP1 and OP2. If OP1 and OP2 are both
2067 NaN, then ROP is set to NaN. If OP1 or OP2 is NaN, then ROP is set
2068 to the numeric value. If OP1 and OP2 are zeros of different signs,
2069 then ROP is set to -0.
2071 -- Function: int mpfr_max (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
2073 Set ROP to the maximum of OP1 and OP2. If OP1 and OP2 are both
2074 NaN, then ROP is set to NaN. If OP1 or OP2 is NaN, then ROP is set
2075 to the numeric value. If OP1 and OP2 are zeros of different signs,
2076 then ROP is set to +0.
2078 -- Function: int mpfr_urandomb (mpfr_t ROP, gmp_randstate_t STATE)
2079 Generate a uniformly distributed random float in the interval 0 <=
2080 ROP < 1. More precisely, the number can be seen as a float with a
2081 random non-normalized significand and exponent 0, which is then
2082 normalized (thus if E denotes the exponent after normalization,
2083 then the least -E significant bits of the significand are always
2084 0). Return 0, unless the exponent is not in the current exponent
2085 range, in which case ROP is set to NaN and a non-zero value is
2086 returned (this should never happen in practice, except in very
2087 specific cases). The second argument is a `gmp_randstate_t'
2088 structure which should be created using the GMP `gmp_randinit'
2089 function, see the GMP manual.
2091 -- Function: void mpfr_random (mpfr_t ROP)
2092 Generate a uniformly distributed random float in the interval 0 <=
2095 This function is deprecated and will be suppressed in the next
2096 release; `mpfr_urandomb' should be used instead.
2098 -- Function: void mpfr_random2 (mpfr_t ROP, mp_size_t SIZE, mp_exp_t
2100 Generate a random float of at most SIZE limbs, with long strings of
2101 zeros and ones in the binary representation. The exponent of the
2102 number is in the interval -EXP to EXP. This function is useful for
2103 testing functions and algorithms, since this kind of random
2104 numbers have proven to be more likely to trigger corner-case bugs.
2105 Negative random numbers are generated when SIZE is negative. Put
2106 +0 in ROP when size if zero. The internal state of the default
2107 pseudorandom number generator is modified by a call to this
2108 function (the same one as GMP if MPFR was built using
2109 `--with-gmp-build').
2111 This function is deprecated and will be suppressed in the next
2114 -- Function: mp_exp_t mpfr_get_exp (mpfr_t X)
2115 Get the exponent of X, assuming that X is a non-zero ordinary
2116 number and the significand is chosen in [1/2,1). The behavior for
2117 NaN, infinity or zero is undefined.
2119 -- Function: int mpfr_set_exp (mpfr_t X, mp_exp_t E)
2120 Set the exponent of X if E is in the current exponent range, and
2121 return 0 (even if X is not a non-zero ordinary number); otherwise,
2122 return a non-zero value. The significand is assumed to be in
2125 -- Function: int mpfr_signbit (mpfr_t OP)
2126 Return a non-zero value iff OP has its sign bit set (i.e. if it is
2127 negative, -0, or a NaN whose representation has its sign bit set).
2129 -- Function: int mpfr_setsign (mpfr_t ROP, mpfr_t OP, int S, mp_rnd_t
2131 Set the value of ROP from OP, rounded toward the given direction
2132 RND, then set (resp. clear) its sign bit if S is non-zero (resp.
2133 zero), even when OP is a NaN.
2135 -- Function: int mpfr_copysign (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
2137 Set the value of ROP from OP1, rounded toward the given direction
2138 RND, then set its sign bit to that of OP2 (even when OP1 or OP2 is
2139 a NaN). This function is equivalent to `mpfr_setsign (ROP, OP1,
2140 mpfr_signbit (OP2), RND)'.
2142 -- Function: const char * mpfr_get_version (void)
2143 Return the MPFR version, as a null-terminated string.
2145 -- Macro: MPFR_VERSION
2146 -- Macro: MPFR_VERSION_MAJOR
2147 -- Macro: MPFR_VERSION_MINOR
2148 -- Macro: MPFR_VERSION_PATCHLEVEL
2149 -- Macro: MPFR_VERSION_STRING
2150 `MPFR_VERSION' is the version of MPFR as a preprocessing constant.
2151 `MPFR_VERSION_MAJOR', `MPFR_VERSION_MINOR' and
2152 `MPFR_VERSION_PATCHLEVEL' are respectively the major, minor and
2153 patch level of MPFR version, as preprocessing constants.
2154 `MPFR_VERSION_STRING' is the version (with an optional suffix, used
2155 in development and pre-release versions) as a string constant,
2156 which can be compared to the result of `mpfr_get_version' to check
2157 at run time the header file and library used match:
2158 if (strcmp (mpfr_get_version (), MPFR_VERSION_STRING))
2159 fprintf (stderr, "Warning: header and library do not match\n");
2160 Note: Obtaining different strings is not necessarily an error, as
2161 in general, a program compiled with some old MPFR version can be
2162 dynamically linked with a newer MPFR library version (if allowed
2163 by the library versioning system).
2165 -- Macro: long MPFR_VERSION_NUM (MAJOR, MINOR, PATCHLEVEL)
2166 Create an integer in the same format as used by `MPFR_VERSION'
2167 from the given MAJOR, MINOR and PATCHLEVEL. Here is an example of
2168 how to check the MPFR version at compile time:
2169 #if (!defined(MPFR_VERSION) || (MPFR_VERSION<MPFR_VERSION_NUM(2,1,0)))
2170 # error "Wrong MPFR version."
2173 -- Function: const char * mpfr_get_patches (void)
2174 Return a null-terminated string containing the ids of the patches
2175 applied to the MPFR library (contents of the `PATCHES' file),
2176 separated by spaces. Note: If the program has been compiled with
2177 an older MPFR version and is dynamically linked with a new MPFR
2178 library version, the ids of the patches applied to the old
2179 (compile-time) MPFR version are not available (however this
2180 information should not have much interest in general).
2183 File: mpfr.info, Node: Exception Related Functions, Next: Compatibility with MPF, Prev: Miscellaneous Functions, Up: MPFR Interface
2185 5.13 Exception Related Functions
2186 ================================
2188 -- Function: mp_exp_t mpfr_get_emin (void)
2189 -- Function: mp_exp_t mpfr_get_emax (void)
2190 Return the (current) smallest and largest exponents allowed for a
2191 floating-point variable. The smallest positive value of a
2192 floating-point variable is one half times 2 raised to the smallest
2193 exponent and the largest value has the form (1 - epsilon) times 2
2194 raised to the largest exponent.
2196 -- Function: int mpfr_set_emin (mp_exp_t EXP)
2197 -- Function: int mpfr_set_emax (mp_exp_t EXP)
2198 Set the smallest and largest exponents allowed for a
2199 floating-point variable. Return a non-zero value when EXP is not
2200 in the range accepted by the implementation (in that case the
2201 smallest or largest exponent is not changed), and zero otherwise.
2202 If the user changes the exponent range, it is her/his
2203 responsibility to check that all current floating-point variables
2204 are in the new allowed range (for example using
2205 `mpfr_check_range'), otherwise the subsequent behavior will be
2206 undefined, in the sense of the ISO C standard.
2208 -- Function: mp_exp_t mpfr_get_emin_min (void)
2209 -- Function: mp_exp_t mpfr_get_emin_max (void)
2210 -- Function: mp_exp_t mpfr_get_emax_min (void)
2211 -- Function: mp_exp_t mpfr_get_emax_max (void)
2212 Return the minimum and maximum of the smallest and largest
2213 exponents allowed for `mpfr_set_emin' and `mpfr_set_emax'. These
2214 values are implementation dependent; it is possible to create a non
2215 portable program by writing `mpfr_set_emax(mpfr_get_emax_max())'
2216 and `mpfr_set_emin(mpfr_get_emin_min())' since the values of the
2217 smallest and largest exponents become implementation dependent.
2219 -- Function: int mpfr_check_range (mpfr_t X, int T, mp_rnd_t RND)
2220 This function forces X to be in the current range of acceptable
2221 values, T being the current ternary value: negative if X is
2222 smaller than the exact value, positive if X is larger than the
2223 exact value and zero if X is exact (before the call). It generates
2224 an underflow or an overflow if the exponent of X is outside the
2225 current allowed range; the value of T may be used to avoid a
2226 double rounding. This function returns zero if the rounded result
2227 is equal to the exact one, a positive value if the rounded result
2228 is larger than the exact one, a negative value if the rounded
2229 result is smaller than the exact one. Note that unlike most
2230 functions, the result is compared to the exact one, not the input
2231 value X, i.e. the ternary value is propagated.
2233 Note: If X is an infinity and T is different from zero (i.e., if
2234 the rounded result is an inexact infinity), then the overflow flag
2235 is set. This is useful because `mpfr_check_range' is typically
2236 called (at least in MPFR functions) after restoring the flags that
2237 could have been set due to internal computations.
2239 -- Function: int mpfr_subnormalize (mpfr_t X, int T, mp_rnd_t RND)
2240 This function rounds X emulating subnormal number arithmetic: if X
2241 is outside the subnormal exponent range, it just propagates the
2242 ternary value T; otherwise, it rounds X to precision
2243 `EXP(x)-emin+1' according to rounding mode RND and previous
2244 ternary value T, avoiding double rounding problems. More
2245 precisely in the subnormal domain, denoting by E the value of
2246 `emin', X is rounded in fixed-point arithmetic to an integer
2247 multiple of two to the power E-1; as a consequence, 1.5 multiplied
2248 by two to the power E-1 when T is zero is rounded to two to the
2249 power E with rounding to nearest.
2251 `PREC(x)' is not modified by this function. RND and T must be the
2252 used rounding mode for computing X and the returned ternary value
2253 when computing X. The subnormal exponent range is from `emin' to
2254 `emin+PREC(x)-1'. If the result cannot be represented in the
2255 current exponent range (due to a too small `emax'), the behavior
2256 is undefined. Note that unlike most functions, the result is
2257 compared to the exact one, not the input value X, i.e. the ternary
2258 value is propagated. This is a preliminary interface.
2260 This is an example of how to emulate binary double IEEE 754
2261 arithmetic (binary64 in IEEE 754-2008) using MPFR:
2266 volatile double a, b;
2268 mpfr_set_default_prec (53);
2269 mpfr_set_emin (-1073);
2270 mpfr_set_emax (1024);
2272 mpfr_init (xa); mpfr_init (xb);
2274 b = 34.3; mpfr_set_d (xb, b, GMP_RNDN);
2275 a = 0x1.1235P-1021; mpfr_set_d (xa, a, GMP_RNDN);
2278 i = mpfr_div (xa, xa, xb, GMP_RNDN);
2279 i = mpfr_subnormalize (xa, i, GMP_RNDN);
2281 mpfr_clear (xa); mpfr_clear (xb);
2284 Warning: this emulates a double IEEE 754 arithmetic with correct
2285 rounding in the subnormal range, which may not be the case for your
2288 -- Function: void mpfr_clear_underflow (void)
2289 -- Function: void mpfr_clear_overflow (void)
2290 -- Function: void mpfr_clear_nanflag (void)
2291 -- Function: void mpfr_clear_inexflag (void)
2292 -- Function: void mpfr_clear_erangeflag (void)
2293 Clear the underflow, overflow, invalid, inexact and _erange_ flags.
2295 -- Function: void mpfr_set_underflow (void)
2296 -- Function: void mpfr_set_overflow (void)
2297 -- Function: void mpfr_set_nanflag (void)
2298 -- Function: void mpfr_set_inexflag (void)
2299 -- Function: void mpfr_set_erangeflag (void)
2300 Set the underflow, overflow, invalid, inexact and _erange_ flags.
2302 -- Function: void mpfr_clear_flags (void)
2303 Clear all global flags (underflow, overflow, inexact, invalid,
2306 -- Function: int mpfr_underflow_p (void)
2307 -- Function: int mpfr_overflow_p (void)
2308 -- Function: int mpfr_nanflag_p (void)
2309 -- Function: int mpfr_inexflag_p (void)
2310 -- Function: int mpfr_erangeflag_p (void)
2311 Return the corresponding (underflow, overflow, invalid, inexact,
2312 _erange_) flag, which is non-zero iff the flag is set.
2315 File: mpfr.info, Node: Compatibility with MPF, Next: Custom Interface, Prev: Exception Related Functions, Up: MPFR Interface
2317 5.14 Compatibility With MPF
2318 ===========================
2320 A header file `mpf2mpfr.h' is included in the distribution of MPFR for
2321 compatibility with the GNU MP class MPF. After inserting the following
2322 two lines after the `#include <gmp.h>' line,
2324 #include <mpf2mpfr.h>
2325 any program written for MPF can be compiled directly with MPFR without
2326 any changes. All operations are then performed with the default MPFR
2327 rounding mode, which can be reset with `mpfr_set_default_rounding_mode'.
2329 Warning: the `mpf_init' and `mpf_init2' functions initialize to
2330 zero, whereas the corresponding MPFR functions initialize to NaN: this
2331 is useful to detect uninitialized values, but is slightly incompatible
2334 -- Function: void mpfr_set_prec_raw (mpfr_t X, mp_prec_t PREC)
2335 Reset the precision of X to be *exactly* PREC bits. The only
2336 difference with `mpfr_set_prec' is that PREC is assumed to be
2337 small enough so that the significand fits into the current
2338 allocated memory space for X. Otherwise the behavior is undefined.
2340 -- Function: int mpfr_eq (mpfr_t OP1, mpfr_t OP2, unsigned long int
2342 Return non-zero if OP1 and OP2 are both non-zero ordinary numbers
2343 with the same exponent and the same first OP3 bits, both zero, or
2344 both infinities of the same sign. Return zero otherwise. This
2345 function is defined for compatibility with `mpf'. Do not use it if
2346 you want to know whether two numbers are close to each other; for
2347 instance, 1.011111 and 1.100000 are currently regarded as
2348 different for any value of OP3 larger than 1 (but this may change
2349 in the next release).
2351 -- Function: void mpfr_reldiff (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2,
2353 Compute the relative difference between OP1 and OP2 and store the
2354 result in ROP. This function does not guarantee the correct
2355 rounding on the relative difference; it just computes
2356 |OP1-OP2|/OP1, using the rounding mode RND for all operations and
2357 the precision of ROP.
2359 -- Function: int mpfr_mul_2exp (mpfr_t ROP, mpfr_t OP1, unsigned long
2360 int OP2, mp_rnd_t RND)
2361 -- Function: int mpfr_div_2exp (mpfr_t ROP, mpfr_t OP1, unsigned long
2362 int OP2, mp_rnd_t RND)
2363 See `mpfr_mul_2ui' and `mpfr_div_2ui'. These functions are only
2364 kept for compatibility with MPF.
2367 File: mpfr.info, Node: Custom Interface, Next: Internals, Prev: Compatibility with MPF, Up: MPFR Interface
2369 5.15 Custom Interface
2370 =====================
2372 Some applications use a stack to handle the memory and their objects.
2373 However, the MPFR memory design is not well suited for such a thing. So
2374 that such applications are able to use MPFR, an auxiliary memory
2375 interface has been created: the Custom Interface.
2377 The following interface allows them to use MPFR in two ways:
2378 * Either they directly store the MPFR FP number as a `mpfr_t' on the
2381 * Either they store their own representation of a FP number on the
2382 stack and construct a new temporary `mpfr_t' each time it is
2384 Nothing has to be done to destroy the FP numbers except garbaging
2385 the used memory: all the memory stuff (allocating, destroying,
2386 garbaging) is kept to the application.
2388 Each function in this interface is also implemented as a macro for
2389 efficiency reasons: for example `mpfr_custom_init (s, p)' uses the
2390 macro, while `(mpfr_custom_init) (s, p)' uses the function.
2392 Note 1: MPFR functions may still initialize temporary FP numbers
2393 using standard mpfr_init. See Custom Allocation (GNU MP).
2395 Note 2: MPFR functions may use the cached functions (mpfr_const_pi
2396 for example), even if they are not explicitly called. You have to call
2397 `mpfr_free_cache' each time you garbage the memory iff mpfr_init,
2398 through GMP Custom Allocation, allocates its memory on the application
2401 Note 3: This interface is preliminary.
2403 -- Function: size_t mpfr_custom_get_size (mp_prec_t PREC)
2404 Return the needed size in bytes to store the significand of a FP
2405 number of precision PREC.
2407 -- Function: void mpfr_custom_init (void *SIGNIFICAND, mp_prec_t PREC)
2408 Initialize a significand of precision PREC. SIGNIFICAND must be
2409 an area of `mpfr_custom_get_size (prec)' bytes at least and be
2410 suitably aligned for an array of `mp_limb_t'.
2412 -- Function: void mpfr_custom_init_set (mpfr_t X, int KIND, mp_exp_t
2413 EXP, mp_prec_t PREC, void *SIGNIFICAND)
2414 Perform a dummy initialization of a `mpfr_t' and set it to:
2415 * if `ABS(kind) == MPFR_NAN_KIND', X is set to NaN;
2417 * if `ABS(kind) == MPFR_INF_KIND', X is set to the infinity of
2420 * if `ABS(kind) == MPFR_ZERO_KIND', X is set to the zero of
2423 * if `ABS(kind) == MPFR_REGULAR_KIND', X is set to a regular
2424 number: `x = sign(kind)*significand*2^exp'
2425 In all cases, it uses SIGNIFICAND directly for further computing
2426 involving X. It will not allocate anything. A FP number
2427 initialized with this function cannot be resized using
2428 `mpfr_set_prec', or cleared using `mpfr_clear'! SIGNIFICAND must
2429 have been initialized with `mpfr_custom_init' using the same
2432 -- Function: int mpfr_custom_get_kind (mpfr_t X)
2433 Return the current kind of a `mpfr_t' as used by
2434 `mpfr_custom_init_set'. The behavior of this function for any
2435 `mpfr_t' not initialized with `mpfr_custom_init_set' is undefined.
2437 -- Function: void * mpfr_custom_get_mantissa (mpfr_t X)
2438 Return a pointer to the significand used by a `mpfr_t' initialized
2439 with `mpfr_custom_init_set'. The behavior of this function for
2440 any `mpfr_t' not initialized with `mpfr_custom_init_set' is
2443 -- Function: mp_exp_t mpfr_custom_get_exp (mpfr_t X)
2444 Return the exponent of X, assuming that X is a non-zero ordinary
2445 number. The return value for NaN, Infinity or Zero is unspecified
2446 but does not produce any trap. The behavior of this function for
2447 any `mpfr_t' not initialized with `mpfr_custom_init_set' is
2450 -- Function: void mpfr_custom_move (mpfr_t X, void *NEW_POSITION)
2451 Inform MPFR that the significand has moved due to a garbage collect
2452 and update its new position to `new_position'. However the
2453 application has to move the significand and the `mpfr_t' itself.
2454 The behavior of this function for any `mpfr_t' not initialized
2455 with `mpfr_custom_init_set' is undefined.
2457 See the test suite for examples.
2460 File: mpfr.info, Node: Internals, Prev: Custom Interface, Up: MPFR Interface
2465 The following types and functions were mainly designed for the
2466 implementation of MPFR, but may be useful for users too. However no
2467 upward compatibility is guaranteed. You may need to include
2468 `mpfr-impl.h' to use them.
2470 The `mpfr_t' type consists of four fields.
2472 * The `_mpfr_prec' field is used to store the precision of the
2473 variable (in bits); this is not less than `MPFR_PREC_MIN'.
2475 * The `_mpfr_sign' field is used to store the sign of the variable.
2477 * The `_mpfr_exp' field stores the exponent. An exponent of 0 means
2478 a radix point just above the most significant limb. Non-zero
2479 values n are a multiplier 2^n relative to that point. A NaN, an
2480 infinity and a zero are indicated by a special value of the
2483 * Finally, the `_mpfr_d' is a pointer to the limbs, least
2484 significant limbs stored first. The number of limbs in use is
2485 controlled by `_mpfr_prec', namely
2486 ceil(`_mpfr_prec'/`mp_bits_per_limb'). Non-singular values always
2487 have the most significant bit of the most significant limb set to
2488 1. When the precision does not correspond to a whole number of
2489 limbs, the excess bits at the low end of the data are zero.
2493 File: mpfr.info, Node: Contributors, Next: References, Prev: MPFR Interface, Up: Top
2498 The main developers of MPFR are Guillaume Hanrot, Vincent Lefèvre,
2499 Patrick Pélissier, Philippe Théveny and Paul Zimmermann.
2501 Sylvie Boldo from ENS-Lyon, France, contributed the functions
2502 `mpfr_agm' and `mpfr_log'. Emmanuel Jeandel, from ENS-Lyon too,
2503 contributed the generic hypergeometric code, as well as the `mpfr_exp3',
2504 a first implementation of the sine and cosine, and improved versions of
2505 `mpfr_const_log2' and `mpfr_const_pi'. Mathieu Dutour contributed the
2506 functions `mpfr_atan' and `mpfr_asin', and a previous version of
2507 `mpfr_gamma'; David Daney contributed the hyperbolic and inverse
2508 hyperbolic functions, the base-2 exponential, and the factorial
2509 function. Fabrice Rouillier contributed the original version of
2510 `mul_ui.c', the `gmp_op.c' file, and helped to the Microsoft Windows
2511 porting. Jean-Luc Rémy contributed the `mpfr_zeta' code. Ludovic
2512 Meunier helped in the design of the `mpfr_erf' code. Damien Stehlé
2513 contributed the `mpfr_get_ld_2exp' function.
2515 We would like to thank Jean-Michel Muller and Joris van der Hoeven
2516 for very fruitful discussions at the beginning of that project,
2517 Torbjörn Granlund and Kevin Ryde for their help about design issues,
2518 and Nathalie Revol for her careful reading of a previous version of
2519 this documentation. Kevin Ryde did a tremendous job for the
2520 portability of MPFR in 2002-2004.
2522 The development of the MPFR library would not have been possible
2523 without the continuous support of INRIA, and of the LORIA (Nancy,
2524 France) and LIP (Lyon, France) laboratories. In particular the main
2525 authors were or are members of the PolKA, Spaces, Cacao project-teams
2526 at LORIA and of the Arenaire project-team at LIP. This project was
2527 started during the Fiable (reliable in French) action supported by
2528 INRIA, and continued during the AOC action. The development of MPFR
2529 was also supported by a grant (202F0659 00 MPN 121) from the Conseil
2530 Régional de Lorraine in 2002, and from INRIA by an "associate engineer"
2531 grant (2003-2005) and an "opération de développement logiciel" grant
2535 File: mpfr.info, Node: References, Next: GNU Free Documentation License, Prev: Contributors, Up: Top
2540 * Laurent Fousse, Guillaume Hanrot, Vincent Lefèvre, Patrick
2541 Pélissier and Paul Zimmermann, "MPFR: A Multiple-Precision Binary
2542 Floating-Point Library With Correct Rounding", ACM Transactions on
2543 Mathematical Software, volume 33, issue 2, article 13, 15 pages,
2544 2007, `http://doi.acm.org/10.1145/1236463.1236468'.
2546 * Torbjörn Granlund, "GNU MP: The GNU Multiple Precision Arithmetic
2547 Library", version 4.2.2, 2007, `http://gmplib.org'.
2549 * IEEE standard for binary floating-point arithmetic, Technical
2550 Report ANSI-IEEE Standard 754-1985, New York, 1985. Approved
2551 March 21, 1985: IEEE Standards Board; approved July 26, 1985:
2552 American National Standards Institute, 18 pages.
2554 * IEEE Standard for Floating-Point Arithmetic, ANSI-IEEE Standard
2555 754-2008, 2008. Revision of ANSI-IEEE Standard 754-1985, approved
2556 June 12, 2008: IEEE Standards Board, 70 pages.
2558 * Donald E. Knuth, "The Art of Computer Programming", vol 2,
2559 "Seminumerical Algorithms", 2nd edition, Addison-Wesley, 1981.
2561 * Jean-Michel Muller, "Elementary Functions, Algorithms and
2562 Implementation", Birkhauser, Boston, 2nd edition, 2006.
2566 File: mpfr.info, Node: GNU Free Documentation License, Next: Concept Index, Prev: References, Up: Top
2568 Appendix A GNU Free Documentation License
2569 *****************************************
2571 Version 1.2, November 2002
2573 Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
2574 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
2576 Everyone is permitted to copy and distribute verbatim copies
2577 of this license document, but changing it is not allowed.
2581 The purpose of this License is to make a manual, textbook, or other
2582 functional and useful document "free" in the sense of freedom: to
2583 assure everyone the effective freedom to copy and redistribute it,
2584 with or without modifying it, either commercially or
2585 noncommercially. Secondarily, this License preserves for the
2586 author and publisher a way to get credit for their work, while not
2587 being considered responsible for modifications made by others.
2589 This License is a kind of "copyleft", which means that derivative
2590 works of the document must themselves be free in the same sense.
2591 It complements the GNU General Public License, which is a copyleft
2592 license designed for free software.
2594 We have designed this License in order to use it for manuals for
2595 free software, because free software needs free documentation: a
2596 free program should come with manuals providing the same freedoms
2597 that the software does. But this License is not limited to
2598 software manuals; it can be used for any textual work, regardless
2599 of subject matter or whether it is published as a printed book.
2600 We recommend this License principally for works whose purpose is
2601 instruction or reference.
2603 1. APPLICABILITY AND DEFINITIONS
2605 This License applies to any manual or other work, in any medium,
2606 that contains a notice placed by the copyright holder saying it
2607 can be distributed under the terms of this License. Such a notice
2608 grants a world-wide, royalty-free license, unlimited in duration,
2609 to use that work under the conditions stated herein. The
2610 "Document", below, refers to any such manual or work. Any member
2611 of the public is a licensee, and is addressed as "you". You
2612 accept the license if you copy, modify or distribute the work in a
2613 way requiring permission under copyright law.
2615 A "Modified Version" of the Document means any work containing the
2616 Document or a portion of it, either copied verbatim, or with
2617 modifications and/or translated into another language.
2619 A "Secondary Section" is a named appendix or a front-matter section
2620 of the Document that deals exclusively with the relationship of the
2621 publishers or authors of the Document to the Document's overall
2622 subject (or to related matters) and contains nothing that could
2623 fall directly within that overall subject. (Thus, if the Document
2624 is in part a textbook of mathematics, a Secondary Section may not
2625 explain any mathematics.) The relationship could be a matter of
2626 historical connection with the subject or with related matters, or
2627 of legal, commercial, philosophical, ethical or political position
2630 The "Invariant Sections" are certain Secondary Sections whose
2631 titles are designated, as being those of Invariant Sections, in
2632 the notice that says that the Document is released under this
2633 License. If a section does not fit the above definition of
2634 Secondary then it is not allowed to be designated as Invariant.
2635 The Document may contain zero Invariant Sections. If the Document
2636 does not identify any Invariant Sections then there are none.
2638 The "Cover Texts" are certain short passages of text that are
2639 listed, as Front-Cover Texts or Back-Cover Texts, in the notice
2640 that says that the Document is released under this License. A
2641 Front-Cover Text may be at most 5 words, and a Back-Cover Text may
2642 be at most 25 words.
2644 A "Transparent" copy of the Document means a machine-readable copy,
2645 represented in a format whose specification is available to the
2646 general public, that is suitable for revising the document
2647 straightforwardly with generic text editors or (for images
2648 composed of pixels) generic paint programs or (for drawings) some
2649 widely available drawing editor, and that is suitable for input to
2650 text formatters or for automatic translation to a variety of
2651 formats suitable for input to text formatters. A copy made in an
2652 otherwise Transparent file format whose markup, or absence of
2653 markup, has been arranged to thwart or discourage subsequent
2654 modification by readers is not Transparent. An image format is
2655 not Transparent if used for any substantial amount of text. A
2656 copy that is not "Transparent" is called "Opaque".
2658 Examples of suitable formats for Transparent copies include plain
2659 ASCII without markup, Texinfo input format, LaTeX input format,
2660 SGML or XML using a publicly available DTD, and
2661 standard-conforming simple HTML, PostScript or PDF designed for
2662 human modification. Examples of transparent image formats include
2663 PNG, XCF and JPG. Opaque formats include proprietary formats that
2664 can be read and edited only by proprietary word processors, SGML or
2665 XML for which the DTD and/or processing tools are not generally
2666 available, and the machine-generated HTML, PostScript or PDF
2667 produced by some word processors for output purposes only.
2669 The "Title Page" means, for a printed book, the title page itself,
2670 plus such following pages as are needed to hold, legibly, the
2671 material this License requires to appear in the title page. For
2672 works in formats which do not have any title page as such, "Title
2673 Page" means the text near the most prominent appearance of the
2674 work's title, preceding the beginning of the body of the text.
2676 A section "Entitled XYZ" means a named subunit of the Document
2677 whose title either is precisely XYZ or contains XYZ in parentheses
2678 following text that translates XYZ in another language. (Here XYZ
2679 stands for a specific section name mentioned below, such as
2680 "Acknowledgements", "Dedications", "Endorsements", or "History".)
2681 To "Preserve the Title" of such a section when you modify the
2682 Document means that it remains a section "Entitled XYZ" according
2685 The Document may include Warranty Disclaimers next to the notice
2686 which states that this License applies to the Document. These
2687 Warranty Disclaimers are considered to be included by reference in
2688 this License, but only as regards disclaiming warranties: any other
2689 implication that these Warranty Disclaimers may have is void and
2690 has no effect on the meaning of this License.
2694 You may copy and distribute the Document in any medium, either
2695 commercially or noncommercially, provided that this License, the
2696 copyright notices, and the license notice saying this License
2697 applies to the Document are reproduced in all copies, and that you
2698 add no other conditions whatsoever to those of this License. You
2699 may not use technical measures to obstruct or control the reading
2700 or further copying of the copies you make or distribute. However,
2701 you may accept compensation in exchange for copies. If you
2702 distribute a large enough number of copies you must also follow
2703 the conditions in section 3.
2705 You may also lend copies, under the same conditions stated above,
2706 and you may publicly display copies.
2708 3. COPYING IN QUANTITY
2710 If you publish printed copies (or copies in media that commonly
2711 have printed covers) of the Document, numbering more than 100, and
2712 the Document's license notice requires Cover Texts, you must
2713 enclose the copies in covers that carry, clearly and legibly, all
2714 these Cover Texts: Front-Cover Texts on the front cover, and
2715 Back-Cover Texts on the back cover. Both covers must also clearly
2716 and legibly identify you as the publisher of these copies. The
2717 front cover must present the full title with all words of the
2718 title equally prominent and visible. You may add other material
2719 on the covers in addition. Copying with changes limited to the
2720 covers, as long as they preserve the title of the Document and
2721 satisfy these conditions, can be treated as verbatim copying in
2724 If the required texts for either cover are too voluminous to fit
2725 legibly, you should put the first ones listed (as many as fit
2726 reasonably) on the actual cover, and continue the rest onto
2729 If you publish or distribute Opaque copies of the Document
2730 numbering more than 100, you must either include a
2731 machine-readable Transparent copy along with each Opaque copy, or
2732 state in or with each Opaque copy a computer-network location from
2733 which the general network-using public has access to download
2734 using public-standard network protocols a complete Transparent
2735 copy of the Document, free of added material. If you use the
2736 latter option, you must take reasonably prudent steps, when you
2737 begin distribution of Opaque copies in quantity, to ensure that
2738 this Transparent copy will remain thus accessible at the stated
2739 location until at least one year after the last time you
2740 distribute an Opaque copy (directly or through your agents or
2741 retailers) of that edition to the public.
2743 It is requested, but not required, that you contact the authors of
2744 the Document well before redistributing any large number of
2745 copies, to give them a chance to provide you with an updated
2746 version of the Document.
2750 You may copy and distribute a Modified Version of the Document
2751 under the conditions of sections 2 and 3 above, provided that you
2752 release the Modified Version under precisely this License, with
2753 the Modified Version filling the role of the Document, thus
2754 licensing distribution and modification of the Modified Version to
2755 whoever possesses a copy of it. In addition, you must do these
2756 things in the Modified Version:
2758 A. Use in the Title Page (and on the covers, if any) a title
2759 distinct from that of the Document, and from those of
2760 previous versions (which should, if there were any, be listed
2761 in the History section of the Document). You may use the
2762 same title as a previous version if the original publisher of
2763 that version gives permission.
2765 B. List on the Title Page, as authors, one or more persons or
2766 entities responsible for authorship of the modifications in
2767 the Modified Version, together with at least five of the
2768 principal authors of the Document (all of its principal
2769 authors, if it has fewer than five), unless they release you
2770 from this requirement.
2772 C. State on the Title page the name of the publisher of the
2773 Modified Version, as the publisher.
2775 D. Preserve all the copyright notices of the Document.
2777 E. Add an appropriate copyright notice for your modifications
2778 adjacent to the other copyright notices.
2780 F. Include, immediately after the copyright notices, a license
2781 notice giving the public permission to use the Modified
2782 Version under the terms of this License, in the form shown in
2785 G. Preserve in that license notice the full lists of Invariant
2786 Sections and required Cover Texts given in the Document's
2789 H. Include an unaltered copy of this License.
2791 I. Preserve the section Entitled "History", Preserve its Title,
2792 and add to it an item stating at least the title, year, new
2793 authors, and publisher of the Modified Version as given on
2794 the Title Page. If there is no section Entitled "History" in
2795 the Document, create one stating the title, year, authors,
2796 and publisher of the Document as given on its Title Page,
2797 then add an item describing the Modified Version as stated in
2798 the previous sentence.
2800 J. Preserve the network location, if any, given in the Document
2801 for public access to a Transparent copy of the Document, and
2802 likewise the network locations given in the Document for
2803 previous versions it was based on. These may be placed in
2804 the "History" section. You may omit a network location for a
2805 work that was published at least four years before the
2806 Document itself, or if the original publisher of the version
2807 it refers to gives permission.
2809 K. For any section Entitled "Acknowledgements" or "Dedications",
2810 Preserve the Title of the section, and preserve in the
2811 section all the substance and tone of each of the contributor
2812 acknowledgements and/or dedications given therein.
2814 L. Preserve all the Invariant Sections of the Document,
2815 unaltered in their text and in their titles. Section numbers
2816 or the equivalent are not considered part of the section
2819 M. Delete any section Entitled "Endorsements". Such a section
2820 may not be included in the Modified Version.
2822 N. Do not retitle any existing section to be Entitled
2823 "Endorsements" or to conflict in title with any Invariant
2826 O. Preserve any Warranty Disclaimers.
2828 If the Modified Version includes new front-matter sections or
2829 appendices that qualify as Secondary Sections and contain no
2830 material copied from the Document, you may at your option
2831 designate some or all of these sections as invariant. To do this,
2832 add their titles to the list of Invariant Sections in the Modified
2833 Version's license notice. These titles must be distinct from any
2834 other section titles.
2836 You may add a section Entitled "Endorsements", provided it contains
2837 nothing but endorsements of your Modified Version by various
2838 parties--for example, statements of peer review or that the text
2839 has been approved by an organization as the authoritative
2840 definition of a standard.
2842 You may add a passage of up to five words as a Front-Cover Text,
2843 and a passage of up to 25 words as a Back-Cover Text, to the end
2844 of the list of Cover Texts in the Modified Version. Only one
2845 passage of Front-Cover Text and one of Back-Cover Text may be
2846 added by (or through arrangements made by) any one entity. If the
2847 Document already includes a cover text for the same cover,
2848 previously added by you or by arrangement made by the same entity
2849 you are acting on behalf of, you may not add another; but you may
2850 replace the old one, on explicit permission from the previous
2851 publisher that added the old one.
2853 The author(s) and publisher(s) of the Document do not by this
2854 License give permission to use their names for publicity for or to
2855 assert or imply endorsement of any Modified Version.
2857 5. COMBINING DOCUMENTS
2859 You may combine the Document with other documents released under
2860 this License, under the terms defined in section 4 above for
2861 modified versions, provided that you include in the combination
2862 all of the Invariant Sections of all of the original documents,
2863 unmodified, and list them all as Invariant Sections of your
2864 combined work in its license notice, and that you preserve all
2865 their Warranty Disclaimers.
2867 The combined work need only contain one copy of this License, and
2868 multiple identical Invariant Sections may be replaced with a single
2869 copy. If there are multiple Invariant Sections with the same name
2870 but different contents, make the title of each such section unique
2871 by adding at the end of it, in parentheses, the name of the
2872 original author or publisher of that section if known, or else a
2873 unique number. Make the same adjustment to the section titles in
2874 the list of Invariant Sections in the license notice of the
2877 In the combination, you must combine any sections Entitled
2878 "History" in the various original documents, forming one section
2879 Entitled "History"; likewise combine any sections Entitled
2880 "Acknowledgements", and any sections Entitled "Dedications". You
2881 must delete all sections Entitled "Endorsements."
2883 6. COLLECTIONS OF DOCUMENTS
2885 You may make a collection consisting of the Document and other
2886 documents released under this License, and replace the individual
2887 copies of this License in the various documents with a single copy
2888 that is included in the collection, provided that you follow the
2889 rules of this License for verbatim copying of each of the
2890 documents in all other respects.
2892 You may extract a single document from such a collection, and
2893 distribute it individually under this License, provided you insert
2894 a copy of this License into the extracted document, and follow
2895 this License in all other respects regarding verbatim copying of
2898 7. AGGREGATION WITH INDEPENDENT WORKS
2900 A compilation of the Document or its derivatives with other
2901 separate and independent documents or works, in or on a volume of
2902 a storage or distribution medium, is called an "aggregate" if the
2903 copyright resulting from the compilation is not used to limit the
2904 legal rights of the compilation's users beyond what the individual
2905 works permit. When the Document is included in an aggregate, this
2906 License does not apply to the other works in the aggregate which
2907 are not themselves derivative works of the Document.
2909 If the Cover Text requirement of section 3 is applicable to these
2910 copies of the Document, then if the Document is less than one half
2911 of the entire aggregate, the Document's Cover Texts may be placed
2912 on covers that bracket the Document within the aggregate, or the
2913 electronic equivalent of covers if the Document is in electronic
2914 form. Otherwise they must appear on printed covers that bracket
2915 the whole aggregate.
2919 Translation is considered a kind of modification, so you may
2920 distribute translations of the Document under the terms of section
2921 4. Replacing Invariant Sections with translations requires special
2922 permission from their copyright holders, but you may include
2923 translations of some or all Invariant Sections in addition to the
2924 original versions of these Invariant Sections. You may include a
2925 translation of this License, and all the license notices in the
2926 Document, and any Warranty Disclaimers, provided that you also
2927 include the original English version of this License and the
2928 original versions of those notices and disclaimers. In case of a
2929 disagreement between the translation and the original version of
2930 this License or a notice or disclaimer, the original version will
2933 If a section in the Document is Entitled "Acknowledgements",
2934 "Dedications", or "History", the requirement (section 4) to
2935 Preserve its Title (section 1) will typically require changing the
2940 You may not copy, modify, sublicense, or distribute the Document
2941 except as expressly provided for under this License. Any other
2942 attempt to copy, modify, sublicense or distribute the Document is
2943 void, and will automatically terminate your rights under this
2944 License. However, parties who have received copies, or rights,
2945 from you under this License will not have their licenses
2946 terminated so long as such parties remain in full compliance.
2948 10. FUTURE REVISIONS OF THIS LICENSE
2950 The Free Software Foundation may publish new, revised versions of
2951 the GNU Free Documentation License from time to time. Such new
2952 versions will be similar in spirit to the present version, but may
2953 differ in detail to address new problems or concerns. See
2954 `http://www.gnu.org/copyleft/'.
2956 Each version of the License is given a distinguishing version
2957 number. If the Document specifies that a particular numbered
2958 version of this License "or any later version" applies to it, you
2959 have the option of following the terms and conditions either of
2960 that specified version or of any later version that has been
2961 published (not as a draft) by the Free Software Foundation. If
2962 the Document does not specify a version number of this License,
2963 you may choose any version ever published (not as a draft) by the
2964 Free Software Foundation.
2966 A.1 ADDENDUM: How to use this License for your documents
2967 ========================================================
2969 To use this License in a document you have written, include a copy of
2970 the License in the document and put the following copyright and license
2971 notices just after the title page:
2973 Copyright (C) YEAR YOUR NAME.
2974 Permission is granted to copy, distribute and/or modify this document
2975 under the terms of the GNU Free Documentation License, Version 1.2
2976 or any later version published by the Free Software Foundation;
2977 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
2978 Texts. A copy of the license is included in the section entitled ``GNU
2979 Free Documentation License''.
2981 If you have Invariant Sections, Front-Cover Texts and Back-Cover
2982 Texts, replace the "with...Texts." line with this:
2984 with the Invariant Sections being LIST THEIR TITLES, with
2985 the Front-Cover Texts being LIST, and with the Back-Cover Texts
2988 If you have Invariant Sections without Cover Texts, or some other
2989 combination of the three, merge those two alternatives to suit the
2992 If your document contains nontrivial examples of program code, we
2993 recommend releasing these examples in parallel under your choice of
2994 free software license, such as the GNU General Public License, to
2995 permit their use in free software.
2998 File: mpfr.info, Node: Concept Index, Next: Function Index, Prev: GNU Free Documentation License, Up: Top
3006 * Accuracy: MPFR Interface. (line 28)
3007 * Arithmetic functions: Basic Arithmetic Functions.
3009 * Assignment functions: Assignment Functions. (line 3)
3010 * Basic arithmetic functions: Basic Arithmetic Functions.
3012 * Combined initialization and assignment functions: Combined Initialization and Assignment Functions.
3014 * Comparison functions: Comparison Functions. (line 3)
3015 * Compatibility with MPF: Compatibility with MPF.
3017 * Conditions for copying MPFR: Copying. (line 6)
3018 * Conversion functions: Conversion Functions. (line 3)
3019 * Copying conditions: Copying. (line 6)
3020 * Custom interface: Custom Interface. (line 3)
3021 * Exception related functions: Exception Related Functions.
3023 * FDL, GNU Free Documentation License: GNU Free Documentation License.
3025 * Float arithmetic functions: Basic Arithmetic Functions.
3027 * Float comparisons functions: Comparison Functions. (line 3)
3028 * Float functions: MPFR Interface. (line 6)
3029 * Float input and output functions: Input and Output Functions.
3031 * Float output functions: Formatted Output Functions.
3033 * Floating-point functions: MPFR Interface. (line 6)
3034 * Floating-point number: MPFR Basics. (line 61)
3035 * GNU Free Documentation License: GNU Free Documentation License.
3037 * I/O functions <1>: Formatted Output Functions.
3039 * I/O functions: Input and Output Functions.
3041 * Initialization functions: Initialization Functions.
3043 * Input functions: Input and Output Functions.
3045 * Installation: Installing MPFR. (line 6)
3046 * Integer related functions: Integer Related Functions.
3048 * Internals: Internals. (line 3)
3049 * intmax_t: MPFR Basics. (line 25)
3050 * inttypes.h: MPFR Basics. (line 25)
3051 * libmpfr: MPFR Basics. (line 41)
3052 * Libraries: MPFR Basics. (line 41)
3053 * Libtool: MPFR Basics. (line 47)
3054 * Limb: MPFR Basics. (line 94)
3055 * Linking: MPFR Basics. (line 41)
3056 * Miscellaneous float functions: Miscellaneous Functions.
3058 * mpfr.h: MPFR Basics. (line 9)
3059 * Output functions <1>: Formatted Output Functions.
3061 * Output functions: Input and Output Functions.
3063 * Precision <1>: MPFR Interface. (line 20)
3064 * Precision: MPFR Basics. (line 75)
3065 * Reporting bugs: Reporting Bugs. (line 6)
3066 * Rounding mode related functions: Rounding Related Functions.
3068 * Rounding Modes: MPFR Basics. (line 89)
3069 * Special functions: Special Functions. (line 3)
3070 * stdarg.h: MPFR Basics. (line 22)
3071 * stdint.h: MPFR Basics. (line 25)
3072 * stdio.h: MPFR Basics. (line 15)
3073 * uintmax_t: MPFR Basics. (line 25)
3076 File: mpfr.info, Node: Function Index, Prev: Concept Index, Up: Top
3078 Function and Type Index
3079 ***********************
3084 * mp_prec_t: MPFR Basics. (line 75)
3085 * mp_rnd_t: MPFR Basics. (line 89)
3086 * mpfr_abs: Basic Arithmetic Functions.
3088 * mpfr_acos: Special Functions. (line 48)
3089 * mpfr_acosh: Special Functions. (line 131)
3090 * mpfr_add: Basic Arithmetic Functions.
3092 * mpfr_add_d: Basic Arithmetic Functions.
3094 * mpfr_add_q: Basic Arithmetic Functions.
3096 * mpfr_add_si: Basic Arithmetic Functions.
3098 * mpfr_add_ui: Basic Arithmetic Functions.
3100 * mpfr_add_z: Basic Arithmetic Functions.
3102 * mpfr_agm: Special Functions. (line 221)
3103 * mpfr_asin: Special Functions. (line 49)
3104 * mpfr_asinh: Special Functions. (line 132)
3105 * mpfr_asprintf: Formatted Output Functions.
3107 * mpfr_atan: Special Functions. (line 50)
3108 * mpfr_atan2: Special Functions. (line 60)
3109 * mpfr_atanh: Special Functions. (line 133)
3110 * mpfr_can_round: Rounding Related Functions.
3112 * mpfr_cbrt: Basic Arithmetic Functions.
3114 * mpfr_ceil: Integer Related Functions.
3116 * mpfr_check_range: Exception Related Functions.
3118 * mpfr_clear: Initialization Functions.
3120 * mpfr_clear_erangeflag: Exception Related Functions.
3122 * mpfr_clear_flags: Exception Related Functions.
3124 * mpfr_clear_inexflag: Exception Related Functions.
3126 * mpfr_clear_nanflag: Exception Related Functions.
3128 * mpfr_clear_overflow: Exception Related Functions.
3130 * mpfr_clear_underflow: Exception Related Functions.
3132 * mpfr_clears: Initialization Functions.
3134 * mpfr_cmp: Comparison Functions.
3136 * mpfr_cmp_d: Comparison Functions.
3138 * mpfr_cmp_f: Comparison Functions.
3140 * mpfr_cmp_ld: Comparison Functions.
3142 * mpfr_cmp_q: Comparison Functions.
3144 * mpfr_cmp_si: Comparison Functions.
3146 * mpfr_cmp_si_2exp: Comparison Functions.
3148 * mpfr_cmp_ui: Comparison Functions.
3150 * mpfr_cmp_ui_2exp: Comparison Functions.
3152 * mpfr_cmp_z: Comparison Functions.
3154 * mpfr_cmpabs: Comparison Functions.
3156 * mpfr_const_catalan: Special Functions. (line 242)
3157 * mpfr_const_euler: Special Functions. (line 241)
3158 * mpfr_const_log2: Special Functions. (line 239)
3159 * mpfr_const_pi: Special Functions. (line 240)
3160 * mpfr_copysign: Miscellaneous Functions.
3162 * mpfr_cos: Special Functions. (line 29)
3163 * mpfr_cosh: Special Functions. (line 111)
3164 * mpfr_cot: Special Functions. (line 37)
3165 * mpfr_coth: Special Functions. (line 127)
3166 * mpfr_csc: Special Functions. (line 36)
3167 * mpfr_csch: Special Functions. (line 126)
3168 * mpfr_custom_get_exp: Custom Interface. (line 78)
3169 * mpfr_custom_get_kind: Custom Interface. (line 67)
3170 * mpfr_custom_get_mantissa: Custom Interface. (line 72)
3171 * mpfr_custom_get_size: Custom Interface. (line 38)
3172 * mpfr_custom_init: Custom Interface. (line 42)
3173 * mpfr_custom_init_set: Custom Interface. (line 48)
3174 * mpfr_custom_move: Custom Interface. (line 85)
3175 * mpfr_d_div: Basic Arithmetic Functions.
3177 * mpfr_d_sub: Basic Arithmetic Functions.
3179 * MPFR_DECL_INIT: Initialization Functions.
3181 * mpfr_dim: Basic Arithmetic Functions.
3183 * mpfr_div: Basic Arithmetic Functions.
3185 * mpfr_div_2exp: Compatibility with MPF.
3187 * mpfr_div_2si: Basic Arithmetic Functions.
3189 * mpfr_div_2ui: Basic Arithmetic Functions.
3191 * mpfr_div_d: Basic Arithmetic Functions.
3193 * mpfr_div_q: Basic Arithmetic Functions.
3195 * mpfr_div_si: Basic Arithmetic Functions.
3197 * mpfr_div_ui: Basic Arithmetic Functions.
3199 * mpfr_div_z: Basic Arithmetic Functions.
3201 * mpfr_eint: Special Functions. (line 150)
3202 * mpfr_eq: Compatibility with MPF.
3204 * mpfr_equal_p: Comparison Functions.
3206 * mpfr_erangeflag_p: Exception Related Functions.
3208 * mpfr_erf: Special Functions. (line 186)
3209 * mpfr_erfc: Special Functions. (line 190)
3210 * mpfr_exp: Special Functions. (line 23)
3211 * mpfr_exp10: Special Functions. (line 25)
3212 * mpfr_exp2: Special Functions. (line 24)
3213 * mpfr_expm1: Special Functions. (line 146)
3214 * mpfr_fac_ui: Special Functions. (line 138)
3215 * mpfr_fits_intmax_p: Conversion Functions.
3217 * mpfr_fits_sint_p: Conversion Functions.
3219 * mpfr_fits_slong_p: Conversion Functions.
3221 * mpfr_fits_sshort_p: Conversion Functions.
3223 * mpfr_fits_uint_p: Conversion Functions.
3225 * mpfr_fits_uintmax_p: Conversion Functions.
3227 * mpfr_fits_ulong_p: Conversion Functions.
3229 * mpfr_fits_ushort_p: Conversion Functions.
3231 * mpfr_floor: Integer Related Functions.
3233 * mpfr_fma: Special Functions. (line 213)
3234 * mpfr_fmod: Integer Related Functions.
3236 * mpfr_fms: Special Functions. (line 217)
3237 * mpfr_fprintf: Formatted Output Functions.
3239 * mpfr_frac: Integer Related Functions.
3241 * mpfr_free_cache: Special Functions. (line 249)
3242 * mpfr_free_str: Conversion Functions.
3244 * mpfr_gamma: Special Functions. (line 162)
3245 * mpfr_get_d: Conversion Functions.
3247 * mpfr_get_d_2exp: Conversion Functions.
3249 * mpfr_get_decimal64: Conversion Functions.
3251 * mpfr_get_default_prec: Initialization Functions.
3253 * mpfr_get_default_rounding_mode: Rounding Related Functions.
3255 * mpfr_get_emax: Exception Related Functions.
3257 * mpfr_get_emax_max: Exception Related Functions.
3259 * mpfr_get_emax_min: Exception Related Functions.
3261 * mpfr_get_emin: Exception Related Functions.
3263 * mpfr_get_emin_max: Exception Related Functions.
3265 * mpfr_get_emin_min: Exception Related Functions.
3267 * mpfr_get_exp: Miscellaneous Functions.
3269 * mpfr_get_f: Conversion Functions.
3271 * mpfr_get_ld: Conversion Functions.
3273 * mpfr_get_ld_2exp: Conversion Functions.
3275 * mpfr_get_patches: Miscellaneous Functions.
3277 * mpfr_get_prec: Initialization Functions.
3279 * mpfr_get_si: Conversion Functions.
3281 * mpfr_get_sj: Conversion Functions.
3283 * mpfr_get_str: Conversion Functions.
3285 * mpfr_get_ui: Conversion Functions.
3287 * mpfr_get_uj: Conversion Functions.
3289 * mpfr_get_version: Miscellaneous Functions.
3291 * mpfr_get_z: Conversion Functions.
3293 * mpfr_get_z_exp: Conversion Functions.
3295 * mpfr_greater_p: Comparison Functions.
3297 * mpfr_greaterequal_p: Comparison Functions.
3299 * mpfr_hypot: Special Functions. (line 230)
3300 * mpfr_inexflag_p: Exception Related Functions.
3302 * mpfr_inf_p: Comparison Functions.
3304 * mpfr_init: Initialization Functions.
3306 * mpfr_init2: Initialization Functions.
3308 * mpfr_init_set: Combined Initialization and Assignment Functions.
3310 * mpfr_init_set_d: Combined Initialization and Assignment Functions.
3312 * mpfr_init_set_f: Combined Initialization and Assignment Functions.
3314 * mpfr_init_set_ld: Combined Initialization and Assignment Functions.
3316 * mpfr_init_set_q: Combined Initialization and Assignment Functions.
3318 * mpfr_init_set_si: Combined Initialization and Assignment Functions.
3320 * mpfr_init_set_str: Combined Initialization and Assignment Functions.
3322 * mpfr_init_set_ui: Combined Initialization and Assignment Functions.
3324 * mpfr_init_set_z: Combined Initialization and Assignment Functions.
3326 * mpfr_inits: Initialization Functions.
3328 * mpfr_inits2: Initialization Functions.
3330 * mpfr_inp_str: Input and Output Functions.
3332 * mpfr_integer_p: Integer Related Functions.
3334 * mpfr_j0: Special Functions. (line 194)
3335 * mpfr_j1: Special Functions. (line 195)
3336 * mpfr_jn: Special Functions. (line 196)
3337 * mpfr_less_p: Comparison Functions.
3339 * mpfr_lessequal_p: Comparison Functions.
3341 * mpfr_lessgreater_p: Comparison Functions.
3343 * mpfr_lgamma: Special Functions. (line 172)
3344 * mpfr_li2: Special Functions. (line 157)
3345 * mpfr_lngamma: Special Functions. (line 166)
3346 * mpfr_log: Special Functions. (line 16)
3347 * mpfr_log10: Special Functions. (line 18)
3348 * mpfr_log1p: Special Functions. (line 142)
3349 * mpfr_log2: Special Functions. (line 17)
3350 * mpfr_max: Miscellaneous Functions.
3352 * mpfr_min: Miscellaneous Functions.
3354 * mpfr_modf: Integer Related Functions.
3356 * mpfr_mul: Basic Arithmetic Functions.
3358 * mpfr_mul_2exp: Compatibility with MPF.
3360 * mpfr_mul_2si: Basic Arithmetic Functions.
3362 * mpfr_mul_2ui: Basic Arithmetic Functions.
3364 * mpfr_mul_d: Basic Arithmetic Functions.
3366 * mpfr_mul_q: Basic Arithmetic Functions.
3368 * mpfr_mul_si: Basic Arithmetic Functions.
3370 * mpfr_mul_ui: Basic Arithmetic Functions.
3372 * mpfr_mul_z: Basic Arithmetic Functions.
3374 * mpfr_nan_p: Comparison Functions.
3376 * mpfr_nanflag_p: Exception Related Functions.
3378 * mpfr_neg: Basic Arithmetic Functions.
3380 * mpfr_nextabove: Miscellaneous Functions.
3382 * mpfr_nextbelow: Miscellaneous Functions.
3384 * mpfr_nexttoward: Miscellaneous Functions.
3386 * mpfr_number_p: Comparison Functions.
3388 * mpfr_out_str: Input and Output Functions.
3390 * mpfr_overflow_p: Exception Related Functions.
3392 * mpfr_pow: Basic Arithmetic Functions.
3394 * mpfr_pow_si: Basic Arithmetic Functions.
3396 * mpfr_pow_ui: Basic Arithmetic Functions.
3398 * mpfr_pow_z: Basic Arithmetic Functions.
3400 * mpfr_prec_round: Rounding Related Functions.
3402 * mpfr_print_rnd_mode: Rounding Related Functions.
3404 * mpfr_printf: Formatted Output Functions.
3406 * mpfr_random: Miscellaneous Functions.
3408 * mpfr_random2: Miscellaneous Functions.
3410 * mpfr_rec_sqrt: Basic Arithmetic Functions.
3412 * mpfr_reldiff: Compatibility with MPF.
3414 * mpfr_remainder: Integer Related Functions.
3416 * mpfr_remquo: Integer Related Functions.
3418 * mpfr_rint: Integer Related Functions.
3420 * mpfr_rint_ceil: Integer Related Functions.
3422 * mpfr_rint_floor: Integer Related Functions.
3424 * mpfr_rint_round: Integer Related Functions.
3426 * mpfr_rint_trunc: Integer Related Functions.
3428 * mpfr_root: Basic Arithmetic Functions.
3430 * mpfr_round: Integer Related Functions.
3432 * mpfr_round_prec: Rounding Related Functions.
3434 * mpfr_sec: Special Functions. (line 35)
3435 * mpfr_sech: Special Functions. (line 125)
3436 * mpfr_set: Assignment Functions.
3438 * mpfr_set_d: Assignment Functions.
3440 * mpfr_set_decimal64: Assignment Functions.
3442 * mpfr_set_default_prec: Initialization Functions.
3444 * mpfr_set_default_rounding_mode: Rounding Related Functions.
3446 * mpfr_set_emax: Exception Related Functions.
3448 * mpfr_set_emin: Exception Related Functions.
3450 * mpfr_set_erangeflag: Exception Related Functions.
3452 * mpfr_set_exp: Miscellaneous Functions.
3454 * mpfr_set_f: Assignment Functions.
3456 * mpfr_set_inexflag: Exception Related Functions.
3458 * mpfr_set_inf: Assignment Functions.
3460 * mpfr_set_ld: Assignment Functions.
3462 * mpfr_set_nan: Assignment Functions.
3464 * mpfr_set_nanflag: Exception Related Functions.
3466 * mpfr_set_overflow: Exception Related Functions.
3468 * mpfr_set_prec: Initialization Functions.
3470 * mpfr_set_prec_raw: Compatibility with MPF.
3472 * mpfr_set_q: Assignment Functions.
3474 * mpfr_set_si: Assignment Functions.
3476 * mpfr_set_si_2exp: Assignment Functions.
3478 * mpfr_set_sj: Assignment Functions.
3480 * mpfr_set_sj_2exp: Assignment Functions.
3482 * mpfr_set_str: Assignment Functions.
3484 * mpfr_set_ui: Assignment Functions.
3486 * mpfr_set_ui_2exp: Assignment Functions.
3488 * mpfr_set_uj: Assignment Functions.
3490 * mpfr_set_uj_2exp: Assignment Functions.
3492 * mpfr_set_underflow: Exception Related Functions.
3494 * mpfr_set_z: Assignment Functions.
3496 * mpfr_setsign: Miscellaneous Functions.
3498 * mpfr_sgn: Comparison Functions.
3500 * mpfr_si_div: Basic Arithmetic Functions.
3502 * mpfr_si_sub: Basic Arithmetic Functions.
3504 * mpfr_signbit: Miscellaneous Functions.
3506 * mpfr_sin: Special Functions. (line 30)
3507 * mpfr_sin_cos: Special Functions. (line 42)
3508 * mpfr_sinh: Special Functions. (line 112)
3509 * mpfr_sinh_cosh: Special Functions. (line 118)
3510 * mpfr_snprintf: Formatted Output Functions.
3512 * mpfr_sprintf: Formatted Output Functions.
3514 * mpfr_sqr: Basic Arithmetic Functions.
3516 * mpfr_sqrt: Basic Arithmetic Functions.
3518 * mpfr_sqrt_ui: Basic Arithmetic Functions.
3520 * mpfr_strtofr: Assignment Functions.
3522 * mpfr_sub: Basic Arithmetic Functions.
3524 * mpfr_sub_d: Basic Arithmetic Functions.
3526 * mpfr_sub_q: Basic Arithmetic Functions.
3528 * mpfr_sub_si: Basic Arithmetic Functions.
3530 * mpfr_sub_ui: Basic Arithmetic Functions.
3532 * mpfr_sub_z: Basic Arithmetic Functions.
3534 * mpfr_subnormalize: Exception Related Functions.
3536 * mpfr_sum: Special Functions. (line 258)
3537 * mpfr_swap: Assignment Functions.
3539 * mpfr_t: MPFR Basics. (line 61)
3540 * mpfr_tan: Special Functions. (line 31)
3541 * mpfr_tanh: Special Functions. (line 113)
3542 * mpfr_trunc: Integer Related Functions.
3544 * mpfr_ui_div: Basic Arithmetic Functions.
3546 * mpfr_ui_pow: Basic Arithmetic Functions.
3548 * mpfr_ui_pow_ui: Basic Arithmetic Functions.
3550 * mpfr_ui_sub: Basic Arithmetic Functions.
3552 * mpfr_underflow_p: Exception Related Functions.
3554 * mpfr_unordered_p: Comparison Functions.
3556 * mpfr_urandomb: Miscellaneous Functions.
3558 * mpfr_vasprintf: Formatted Output Functions.
3560 * MPFR_VERSION: Miscellaneous Functions.
3562 * MPFR_VERSION_MAJOR: Miscellaneous Functions.
3564 * MPFR_VERSION_MINOR: Miscellaneous Functions.
3566 * MPFR_VERSION_NUM: Miscellaneous Functions.
3568 * MPFR_VERSION_PATCHLEVEL: Miscellaneous Functions.
3570 * MPFR_VERSION_STRING: Miscellaneous Functions.
3572 * mpfr_vfprintf: Formatted Output Functions.
3574 * mpfr_vprintf: Formatted Output Functions.
3576 * mpfr_vsnprintf: Formatted Output Functions.
3578 * mpfr_vsprintf: Formatted Output Functions.
3580 * mpfr_y0: Special Functions. (line 203)
3581 * mpfr_y1: Special Functions. (line 204)
3582 * mpfr_yn: Special Functions. (line 205)
3583 * mpfr_zero_p: Comparison Functions.
3585 * mpfr_zeta: Special Functions. (line 180)
3586 * mpfr_zeta_ui: Special Functions. (line 182)
3592 Node: Copying
\7f2107
3593 Node: Introduction to MPFR
\7f3837
3594 Node: Installing MPFR
\7f5749
3595 Node: Reporting Bugs
\7f9367
3596 Node: MPFR Basics
\7f10983
3597 Node: MPFR Interface
\7f26220
3598 Node: Initialization Functions
\7f28439
3599 Node: Assignment Functions
\7f35007
3600 Node: Combined Initialization and Assignment Functions
\7f42602
3601 Node: Conversion Functions
\7f43884
3602 Node: Basic Arithmetic Functions
\7f50591
3603 Node: Comparison Functions
\7f59443
3604 Node: Special Functions
\7f62865
3605 Node: Input and Output Functions
\7f75336
3606 Node: Formatted Output Functions
\7f77266
3607 Node: Integer Related Functions
\7f86778
3608 Node: Rounding Related Functions
\7f91669
3609 Node: Miscellaneous Functions
\7f94139
3610 Node: Exception Related Functions
\7f100925
3611 Node: Compatibility with MPF
\7f107078
3612 Node: Custom Interface
\7f109570
3613 Node: Internals
\7f113753
3614 Node: Contributors
\7f115076
3615 Node: References
\7f117241
3616 Node: GNU Free Documentation License
\7f118549
3617 Node: Concept Index
\7f140992
3618 Node: Function Index
\7f146076