1This is mpfr.info, produced by makeinfo version 7.0.3 from mpfr.texi. 2 3This manual documents how to install and use the Multiple Precision 4Floating-Point Reliable Library, version 4.2.1. 5 6 Copyright 1991, 1993-2023 Free Software Foundation, Inc. 7 8 Permission is granted to copy, distribute and/or modify this document 9under the terms of the GNU Free Documentation License, Version 1.2 or 10any later version published by the Free Software Foundation; with no 11Invariant Sections, with no Front-Cover Texts, and with no Back-Cover 12Texts. A copy of the license is included in *note GNU Free 13Documentation License::. 14INFO-DIR-SECTION Software libraries 15START-INFO-DIR-ENTRY 16* mpfr: (mpfr). Multiple Precision Floating-Point Reliable Library. 17END-INFO-DIR-ENTRY 18 19 20File: mpfr.info, Node: Top, Next: Copying, Prev: (dir), Up: (dir) 21 22GNU MPFR 23******** 24 25This manual documents how to install and use the Multiple Precision 26Floating-Point Reliable Library, version 4.2.1. 27 28 Copyright 1991, 1993-2023 Free Software Foundation, Inc. 29 30 Permission is granted to copy, distribute and/or modify this document 31under the terms of the GNU Free Documentation License, Version 1.2 or 32any later version published by the Free Software Foundation; with no 33Invariant Sections, with no Front-Cover Texts, and with no Back-Cover 34Texts. A copy of the license is included in *note GNU Free 35Documentation License::. 36 37* Menu: 38 39* Copying:: MPFR Copying Conditions (LGPL). 40* Introduction to MPFR:: Brief introduction to GNU MPFR. 41* Installing MPFR:: How to configure and compile the MPFR library. 42* Reporting Bugs:: How to usefully report bugs. 43* MPFR Basics:: What every MPFR user should now. 44* MPFR Interface:: MPFR functions and macros. 45* API Compatibility:: API compatibility with previous MPFR versions. 46* MPFR and the IEEE 754 Standard:: 47* Contributors:: 48* References:: 49* GNU Free Documentation License:: 50* Concept Index:: 51* Function and Type Index:: 52 53 54File: mpfr.info, Node: Copying, Next: Introduction to MPFR, Prev: Top, Up: Top 55 56MPFR Copying Conditions 57*********************** 58 59The GNU MPFR library (or MPFR for short) is ���free���; this means that 60everyone is free to use it and free to redistribute it on a free basis. 61The library is not in the public domain; it is copyrighted and there are 62restrictions on its distribution, but these restrictions are designed to 63permit everything that a good cooperating citizen would want to do. 64What is not allowed is to try to prevent others from further sharing any 65version of this library that they might get from you. 66 67 Specifically, we want to make sure that you have the right to give 68away copies of the library, that you receive source code or else can get 69it if you want it, that you can change this library or use pieces of it 70in new free programs, and that you know you can do these things. 71 72 To make sure that everyone has such rights, we have to forbid you to 73deprive anyone else of these rights. For example, if you distribute 74copies of the GNU MPFR library, you must give the recipients all the 75rights that you have. You must make sure that they, too, receive or can 76get the source code. And you must tell them their rights. 77 78 Also, for our own protection, we must make certain that everyone 79finds out that there is no warranty for the GNU MPFR library. If it is 80modified by someone else and passed on, we want their recipients to know 81that what they have is not what we distributed, so that any problems 82introduced by others will not reflect on our reputation. 83 84 The precise conditions of the license for the GNU MPFR library are 85found in the Lesser General Public License that accompanies the source 86code. See the file COPYING.LESSER.. 87 88 89File: mpfr.info, Node: Introduction to MPFR, Next: Installing MPFR, Prev: Copying, Up: Top 90 911 Introduction to MPFR 92********************** 93 94MPFR is a portable library written in C for arbitrary precision 95arithmetic on floating-point numbers. It is based on the GNU MP 96library. It aims to provide a class of floating-point numbers with 97precise semantics. The main characteristics of MPFR, which make it 98differ from most arbitrary precision floating-point software tools, are: 99 100 ��� the MPFR code is portable, i.e., the result of any operation does 101 not depend on the machine word size ���mp_bits_per_limb��� (64 on most 102 current processors), possibly except in faithful rounding. It does 103 not depend either on the machine rounding mode or rounding 104 precision; 105 106 ��� the precision in bits can be set _exactly_ to any valid value for 107 each variable (including very small precision); 108 109 ��� MPFR provides the four rounding modes from the IEEE 754-1985 110 standard, plus away-from-zero, as well as for basic operations as 111 for other mathematical functions. Faithful rounding (partially 112 supported) is provided too, but the results may no longer be 113 reproducible. 114 115 In particular, MPFR follows the specification of the IEEE 754 116standard, currently IEEE 754-2019 (which will be referred to as IEEE 754 117in this manual), with some minor differences, such as: there is a single 118NaN, the default exponent range is much wider, and subnormal numbers are 119not implemented (but the exponent range can be reduced to any interval, 120and subnormals can be emulated). For instance, computations in the 121binary64 format (a.k.a. double precision) can be reproduced by using a 122precision of 53 bits. 123 124 This version of MPFR is released under the GNU Lesser General Public 125License, version 3 or any later version. It is permitted to link MPFR 126to most non-free programs, as long as when distributing them the MPFR 127source code and a means to re-link with a modified MPFR library is 128provided. 129 1301.1 How to Use This Manual 131========================== 132 133Everyone should read *note MPFR Basics::. If you need to install the 134library yourself, you need to read *note Installing MPFR::, too. To use 135the library you will need to refer to *note MPFR Interface::. 136 137 The rest of the manual can be used for later reference, although it 138is probably a good idea to glance through it. 139 140 141File: mpfr.info, Node: Installing MPFR, Next: Reporting Bugs, Prev: Introduction to MPFR, Up: Top 142 1432 Installing MPFR 144***************** 145 146The MPFR library is already installed on some GNU/Linux distributions, 147but the development files necessary to the compilation such as ���mpfr.h��� 148are not always present. To check that MPFR is fully installed on your 149computer, you can check the presence of the file ���mpfr.h��� in 150���/usr/include���, or try to compile a small program having ���#include 151<mpfr.h>��� (since ���mpfr.h��� may be installed somewhere else). For 152instance, you can try to compile: 153 154 #include <stdio.h> 155 #include <mpfr.h> 156 int main (void) 157 { 158 printf ("MPFR library: %-12s\nMPFR header: %s (based on %d.%d.%d)\n", 159 mpfr_get_version (), MPFR_VERSION_STRING, MPFR_VERSION_MAJOR, 160 MPFR_VERSION_MINOR, MPFR_VERSION_PATCHLEVEL); 161 return 0; 162 } 163 164with 165 166 cc -o version version.c -lmpfr -lgmp 167 168and if you get errors whose first line looks like 169 170 version.c:2:19: error: mpfr.h: No such file or directory 171 172then MPFR is probably not installed. Running this program will give you 173the MPFR version. 174 175 If MPFR is not installed on your computer, or if you want to install 176a different version, please follow the steps below. 177 1782.1 How to Install 179================== 180 181Here are the steps needed to install the library on Unix systems (more 182details are provided in the ���INSTALL��� file): 183 184 1. To build MPFR, you first have to install GNU MP (version 5.0.0 or 185 higher) on your computer. You need a C compiler, preferably GCC, 186 but any reasonable compiler should work (C++ compilers should work 187 too, under the condition that they do not break type punning via 188 union). And you need the standard Unix ���make��� command, plus some 189 other standard Unix utility commands. 190 191 Then, in the MPFR build directory, type the following commands. 192 193 2. ���./configure��� 194 195 This will prepare the build and set up the options according to 196 your system. You can give options to specify the install 197 directories (instead of the default ���/usr/local���), threading 198 support, and so on. See the ���INSTALL��� file and/or the output of 199 ���./configure --help��� for more information, in particular if you get 200 error messages. 201 202 3. ���make��� 203 204 This will compile MPFR, and create a library archive file 205 ���libmpfr.a���. On most platforms, a dynamic library will be produced 206 too. 207 208 4. ���make check��� 209 210 This will make sure that MPFR was built correctly. If any test 211 fails, information about this failure can be found in the 212 ���tests/test-suite.log��� file. If you want the contents of this file 213 to be automatically output in case of failure, you can set the 214 ���VERBOSE��� environment variable to 1 before running ���make check���, 215 for instance by typing: 216 217 ���VERBOSE=1 make check��� 218 219 In case of failure, you may want to check whether the problem is 220 already known. If not, please report this failure to the MPFR 221 mailing-list ���mpfr@inria.fr���. For details, see *note Reporting 222 Bugs::. 223 224 5. ���make install��� 225 226 This will copy the files ���mpfr.h��� and ���mpf2mpfr.h��� to the directory 227 ���/usr/local/include���, the library files (���libmpfr.a��� and possibly 228 others) to the directory ���/usr/local/lib���, the file ���mpfr.info��� to 229 the directory ���/usr/local/share/info���, and some other documentation 230 files to the directory ���/usr/local/share/doc/mpfr��� (or if you 231 passed the ���--prefix��� option to ���configure���, using the prefix 232 directory given as argument to ���--prefix��� instead of ���/usr/local���). 233 2342.2 Other ���make��� Targets 235======================== 236 237There are some other useful make targets: 238 239 ��� ���mpfr.info��� or ���info��� 240 241 Create or update an info version of the manual, in ���mpfr.info���. 242 243 This file is already provided in the MPFR archives. 244 245 ��� ���mpfr.pdf��� or ���pdf��� 246 247 Create a PDF version of the manual, in ���mpfr.pdf���. 248 249 ��� ���mpfr.dvi��� or ���dvi��� 250 251 Create a DVI version of the manual, in ���mpfr.dvi���. 252 253 ��� ���mpfr.ps��� or ���ps��� 254 255 Create a PostScript version of the manual, in ���mpfr.ps���. 256 257 ��� ���mpfr.html��� or ���html��� 258 259 Create a HTML version of the manual, in several pages in the 260 directory ���doc/mpfr.html���; if you want only one output HTML file, 261 then type ���makeinfo --html --no-split mpfr.texi��� from the ���doc��� 262 directory instead. 263 264 ��� ���clean��� 265 266 Delete all object files and archive files, but not the 267 configuration files. 268 269 ��� ���distclean��� 270 271 Delete all generated files not included in the distribution. 272 273 ��� ���uninstall��� 274 275 Delete all files copied by ���make install���. 276 2772.3 Build Problems 278================== 279 280In case of problem, please read the ���INSTALL��� file carefully before 281reporting a bug, in particular section ���In case of problem���. Some 282problems are due to bad configuration on the user side (not specific to 283MPFR). Problems are also mentioned in the FAQ 284<https://www.mpfr.org/faq.html>. 285 286 Please report problems to the MPFR mailing-list ���mpfr@inria.fr���. 287*Note Reporting Bugs::. Some bug fixes are available on the MPFR 4.2.1 288web page <https://www.mpfr.org/mpfr-4.2.1/>. 289 2902.4 Getting the Latest Version of MPFR 291====================================== 292 293The latest version of MPFR is available from 294<https://ftp.gnu.org/gnu/mpfr/> or <https://www.mpfr.org/>. 295 296 297File: mpfr.info, Node: Reporting Bugs, Next: MPFR Basics, Prev: Installing MPFR, Up: Top 298 2993 Reporting Bugs 300**************** 301 302If you think you have found a bug in the MPFR library, first have a look 303on the MPFR 4.2.1 web page <https://www.mpfr.org/mpfr-4.2.1/> and the 304FAQ <https://www.mpfr.org/faq.html>: perhaps this bug is already known, 305in which case you may find there a workaround for it. You might also 306look in the archives of the MPFR mailing-list: 307<https://sympa.inria.fr/sympa/arc/mpfr>. Otherwise, please investigate 308and report it. We have made this library available to you, and it is 309not to ask too much from you to ask you to report the bugs that you 310find. 311 312 There are a few things you should think about when you put your bug 313report together. 314 315 You have to send us a test case that makes it possible for us to 316reproduce the bug, i.e., a small self-content program, using no other 317library than MPFR. Include instructions on how to run the test case. 318 319 You also have to explain what is wrong; if you get a crash, or if the 320results you get are incorrect and in that case, in what way. 321 322 Please include compiler version information in your bug report. This 323can be extracted using ���cc -V��� on some machines, or, if you are using 324GCC, ���gcc -v���. Also, include the output from ���uname -a��� and the MPFR 325version (the GMP version may be useful too). If you get a failure while 326running ���make��� or ���make check���, please include the ���config.log��� file in 327your bug report, and in case of test failure, the ���tests/test-suite.log��� 328file too. 329 330 If your bug report is good, we will do our best to help you to get a 331corrected version of the library; if the bug report is poor, we will not 332do anything about it (aside of chiding you to send better bug reports). 333 334 Send your bug report to the MPFR mailing-list ���mpfr@inria.fr���. 335 336 If you think something in this manual is unclear, or downright 337incorrect, or if the language needs to be improved, please send a note 338to the same address. 339 340 341File: mpfr.info, Node: MPFR Basics, Next: MPFR Interface, Prev: Reporting Bugs, Up: Top 342 3434 MPFR Basics 344************* 345 346* Menu: 347 348* Headers and Libraries:: 349* Nomenclature and Types:: 350* MPFR Variable Conventions:: 351* Rounding:: 352* Floating-Point Values on Special Numbers:: 353* Exceptions:: 354* Memory Handling:: 355* Getting the Best Efficiency Out of MPFR:: 356 357 358File: mpfr.info, Node: Headers and Libraries, Next: Nomenclature and Types, Prev: MPFR Basics, Up: MPFR Basics 359 3604.1 Headers and Libraries 361========================= 362 363All declarations needed to use MPFR are collected in the include file 364���mpfr.h���. It is designed to work with both C and C++ compilers. You 365should include that file in any program using the MPFR library: 366 367 #include <mpfr.h> 368 369 Note, however, that prototypes for MPFR functions with ���FILE *��� 370parameters are provided only if ���<stdio.h>��� is included too (before 371���mpfr.h���): 372 373 #include <stdio.h> 374 #include <mpfr.h> 375 376 Likewise ���<stdarg.h>��� (or ���<varargs.h>���) is required for prototypes 377with ���va_list��� parameters, such as ���mpfr_vprintf���. 378 379 And for any functions using ���intmax_t���, you must include ���<stdint.h>��� 380or ���<inttypes.h>��� before ���mpfr.h���, to allow ���mpfr.h��� to define 381prototypes for these functions. Moreover, under some platforms (in 382particular with C++ compilers), users may need to define 383���MPFR_USE_INTMAX_T��� (and should do it for portability) before ���mpfr.h��� 384has been included; of course, it is possible to do that on the command 385line, e.g., with ���-DMPFR_USE_INTMAX_T���. 386 387 Note: If ���mpfr.h��� and/or ���gmp.h��� (used by ���mpfr.h���) are included 388several times (possibly from another header file), ���<stdio.h>��� and/or 389���<stdarg.h>��� (or ���<varargs.h>���) should be included *before the first 390inclusion* of ���mpfr.h��� or ���gmp.h���. Alternatively, you can define 391���MPFR_USE_FILE��� (for MPFR I/O functions) and/or ���MPFR_USE_VA_LIST��� (for 392MPFR functions with ���va_list��� parameters) anywhere before the last 393inclusion of ���mpfr.h���. As a consequence, if your file is a public 394header that includes ���mpfr.h���, you need to use the latter method. 395 396 When calling a MPFR macro, it is not allowed to have previously 397defined a macro with the same name as some keywords (currently ���do���, 398���while��� and ���sizeof���). 399 400 You can avoid the use of MPFR macros encapsulating functions by 401defining the ���MPFR_USE_NO_MACRO��� macro before ���mpfr.h��� is included. In 402general this should not be necessary, but this can be useful when 403debugging user code: with some macros, the compiler may emit spurious 404warnings with some warning options, and macros can prevent some 405prototype checking. 406 407 All programs using MPFR must link against both ���libmpfr��� and ���libgmp��� 408libraries. On a typical Unix-like system this can be done with ���-lmpfr 409-lgmp��� (in that order), for example: 410 411 gcc myprogram.c -lmpfr -lgmp 412 413 MPFR is built using Libtool and an application can use that to link 414if desired, *note GNU Libtool: (libtool)Top. 415 416 If MPFR has been installed to a non-standard location, then it may be 417necessary to set up environment variables such as ���C_INCLUDE_PATH��� and 418���LIBRARY_PATH���, or use ���-I��� and ���-L��� compiler options, in order to point 419to the right directories. For a shared library, it may also be 420necessary to set up some sort of run-time library path (e.g., 421���LD_LIBRARY_PATH���) on some systems. Please read the ���INSTALL��� file for 422additional information. 423 424 Alternatively, it is possible to use ���pkg-config��� (a file ���mpfr.pc��� 425is provided as of MPFR 4.0): 426 427 cc myprogram.c $(pkg-config --cflags --libs mpfr) 428 429 Note that the ���MPFR_��� and ���mpfr_��� prefixes are reserved for MPFR. As 430a general rule, in order to avoid clashes, software using MPFR (directly 431or indirectly) and system headers/libraries should not define macros and 432symbols using these prefixes. 433 434 435File: mpfr.info, Node: Nomenclature and Types, Next: MPFR Variable Conventions, Prev: Headers and Libraries, Up: MPFR Basics 436 4374.2 Nomenclature and Types 438========================== 439 440A ���floating-point number���, or ���float��� for short, is an object 441representing a radix-2 floating-point number consisting of a sign, an 442arbitrary-precision normalized significand (also called mantissa), and 443an exponent (an integer in some given range); these are called ���regular 444numbers���. By convention, the radix point of the significand is just 445before the first digit (which is always 1 due to normalization), like in 446the C language, but unlike in IEEE 754 (thus, for a given number, the 447exponent values in MPFR and in IEEE 754 differ by 1). 448 449 Like in the IEEE 754 standard, a floating-point number can also have 450three kinds of special values: a signed zero (+0 or ���0), a signed 451infinity (+Inf or ���Inf), and Not-a-Number (NaN). NaN can represent the 452default value of a floating-point object and the result of some 453operations for which no other results would make sense, such as 0 454divided by 0 or +Inf minus +Inf; unless documented otherwise, the sign 455bit of a NaN is unspecified. Note that contrary to IEEE 754, MPFR has a 456single kind of NaN and does not have subnormals. Other than that, the 457behavior is very similar to IEEE 754, but there are some minor 458differences. 459 460 The C data type for such objects is ���mpfr_t���, internally defined as a 461one-element array of a structure (so that when passed as an argument to 462a function, it is the pointer that is actually passed), and ���mpfr_ptr��� 463is the C data type representing a pointer to this structure; 464���mpfr_srcptr��� is like ���mpfr_ptr���, but the structure is read-only (i.e., 465const qualified). 466 467 The ���precision��� is the number of bits used to represent the 468significand of a floating-point number; the corresponding C data type is 469���mpfr_prec_t���. The precision can be any integer between ���MPFR_PREC_MIN��� 470and ���MPFR_PREC_MAX���. In the current implementation, ���MPFR_PREC_MIN��� is 471equal to 1. 472 473 Warning! MPFR needs to increase the precision internally, in order 474to provide accurate results (and in particular, correct rounding). Do 475not attempt to set the precision to any value near ���MPFR_PREC_MAX���, 476otherwise MPFR will abort due to an assertion failure. However, in 477practice, the real limitation will probably be the available memory on 478your platform, and in case of lack of memory, the program may abort, 479crash or have undefined behavior (depending on your C implementation). 480 481 An ���exponent��� is a component of a regular floating-point number. Its 482C data type is ���mpfr_exp_t���. Valid exponents are restricted to a subset 483of this type, and the exponent range can be changed globally as 484described in *note Exception Related Functions::. Special values do not 485have an exponent. 486 487 The ���rounding mode��� specifies the way to round the result of a 488floating-point operation, in case the exact result cannot be represented 489exactly in the destination (*note Rounding::). The corresponding C data 490type is ���mpfr_rnd_t���. 491 492 MPFR has a global (or per-thread) flag for each supported exception 493and provides operations on flags (*note Exceptions::). This C data type 494is used to represent a group of flags (or a mask). 495 496 497File: mpfr.info, Node: MPFR Variable Conventions, Next: Rounding, Prev: Nomenclature and Types, Up: MPFR Basics 498 4994.3 MPFR Variable Conventions 500============================= 501 502Before you can assign to a MPFR variable, you need to initialize it by 503calling one of the special initialization functions. When you are done 504with a variable, you need to clear it out, using one of the functions 505for that purpose. A variable should only be initialized once, or at 506least cleared out between each initialization. After a variable has 507been initialized, it may be assigned to any number of times. For 508efficiency reasons, avoid to initialize and clear out a variable in 509loops. Instead, initialize it before entering the loop, and clear it 510out after the loop has exited. You do not need to be concerned about 511allocating additional space for MPFR variables, since any variable has a 512significand of fixed size. Hence unless you change its precision, or 513clear and reinitialize it, a floating-point variable will have the same 514allocated space during all its life. 515 516 As a general rule, all MPFR functions expect output arguments before 517input arguments. This notation is based on an analogy with the 518assignment operator. MPFR allows you to use the same variable for both 519input and output in the same expression. For example, the main function 520for floating-point multiplication, ���mpfr_mul���, can be used like this: 521���mpfr_mul (x, x, x, rnd)���. This computes the square of X with rounding 522mode ���rnd��� and puts the result back in X. 523 524 525File: mpfr.info, Node: Rounding, Next: Floating-Point Values on Special Numbers, Prev: MPFR Variable Conventions, Up: MPFR Basics 526 5274.4 Rounding 528============ 529 530The following rounding modes are supported: 531 532 ��� ���MPFR_RNDN���: round to nearest, with the even rounding rule 533 (roundTiesToEven in IEEE 754); see details below. 534 535 ��� ���MPFR_RNDD���: round toward negative infinity (roundTowardNegative in 536 IEEE 754). 537 538 ��� ���MPFR_RNDU���: round toward positive infinity (roundTowardPositive in 539 IEEE 754). 540 541 ��� ���MPFR_RNDZ���: round toward zero (roundTowardZero in IEEE 754). 542 543 ��� ���MPFR_RNDA���: round away from zero. 544 545 ��� ���MPFR_RNDF���: faithful rounding. This feature is currently 546 experimental. Specific support for this rounding mode has been 547 added to some functions, such as the basic operations (addition, 548 subtraction, multiplication, square, division, square root) or when 549 explicitly documented. It might also work with other functions, as 550 it is possible that they do not need modification in their code; 551 even though a correct behavior is not guaranteed yet (corrections 552 were done when failures occurred in the test suite, but almost 553 nothing has been checked manually), failures should be regarded as 554 bugs and reported, so that they can be fixed. 555 556 Note that, in particular for a result equal to zero, the sign is 557preserved by the rounding operation. 558 559 The ���MPFR_RNDN��� mode works like roundTiesToEven from the IEEE 754 560standard: in case the number to be rounded lies exactly in the middle 561between two consecutive representable numbers, it is rounded to the one 562with an even significand; in radix 2, this means that the least 563significant bit is 0. For example, the number 2.5, which is represented 564by (10.1) in binary, is rounded to (10.0) = 2 with a precision of two 565bits, and not to (11.0) = 3. This rule avoids the ���drift��� phenomenon 566mentioned by Knuth in volume 2 of The Art of Computer Programming 567(Section 4.2.2). 568 569 Note: In particular for a 1-digit precision (in radix 2 or other 570radices, as in conversions to a string of digits), one considers the 571significands associated with the exponent of the number to be rounded. 572For instance, to round the number 95 in radix 10 with a 1-digit 573precision, one considers its truncated 1-digit integer significand 9 and 574the following integer 10 (since these are consecutive integers, exactly 575one of them is even). 10 is the even significand, so that 95 will be 576rounded to 100, not to 90. 577 578 For the ���directed rounding modes���, a number X is rounded to the 579number Y that is the closest to X such that 580 ��� ���MPFR_RNDD���: Y is less than or equal to X; 581 ��� ���MPFR_RNDU���: Y is greater than or equal to X; 582 ��� ���MPFR_RNDZ���: abs(Y) is less than or equal to abs(X); 583 ��� ���MPFR_RNDA���: abs(Y) is greater than or equal to abs(X). 584 585 The ���MPFR_RNDF��� mode works as follows: the computed value is either 586that corresponding to ���MPFR_RNDD��� or that corresponding to ���MPFR_RNDU���. 587In particular when those values are identical, i.e., when the result of 588the corresponding operation is exactly representable, that exact result 589is returned. Thus, the computed result can take at most two possible 590values, and in absence of underflow/overflow, the corresponding error is 591strictly less than one ulp (unit in the last place) of that result and 592of the exact result. For ���MPFR_RNDF���, the ternary value (defined below) 593and the inexact flag (defined later, as with the other flags) are 594unspecified, the divide-by-zero flag is as with other roundings, and the 595underflow and overflow flags match what would be obtained in the case 596the computed value is the same as with ���MPFR_RNDD��� or ���MPFR_RNDU���. The 597results may not be reproducible. 598 599 Most MPFR functions take as first argument the destination variable, 600as second and following arguments the input variables, as last argument 601a rounding mode, and have a return value of type ���int���, called the 602���ternary value���. The value stored in the destination variable is 603correctly rounded, i.e., MPFR behaves as if it computed the result with 604an infinite precision, then rounded it to the precision of this 605variable. The input variables are regarded as exact (in particular, 606their precision does not affect the result). 607 608 As a consequence, in case of a non-zero real rounded result, the 609error on the result is less than or equal to 1/2 ulp (unit in the last 610place) of that result in the rounding to nearest mode, and less than 1 611ulp of that result in the directed rounding modes (a ulp is the weight 612of the least significant represented bit of the result after rounding). 613 614 Unless documented otherwise, functions returning an ���int��� return a 615ternary value. If the ternary value is zero, it means that the value 616stored in the destination variable is the exact result of the 617corresponding mathematical function. If the ternary value is positive 618(resp. negative), it means the value stored in the destination variable 619is greater (resp. lower) than the exact result. For example with the 620���MPFR_RNDU��� rounding mode, the ternary value is usually positive, except 621when the result is exact, in which case it is zero. In the case of an 622infinite result, it is considered as inexact when it was obtained by 623overflow, and exact otherwise. A NaN result (Not-a-Number) always 624corresponds to an exact return value. The opposite of a returned 625ternary value is guaranteed to be representable in an ���int���. 626 627 Unless documented otherwise, functions returning as result the value 628���1��� (or any other value specified in this manual) for special cases 629(like ���acos(0)���) yield an overflow or an underflow if that value is not 630representable in the current exponent range. 631 632 633File: mpfr.info, Node: Floating-Point Values on Special Numbers, Next: Exceptions, Prev: Rounding, Up: MPFR Basics 634 6354.5 Floating-Point Values on Special Numbers 636============================================ 637 638This section specifies the floating-point values (of type ���mpfr_t���) 639returned by MPFR functions (where by ���returned��� we mean here the 640modified value of the destination object, which should not be mixed with 641the ternary return value of type ���int��� of those functions). For 642functions returning several values (like ���mpfr_sin_cos���), the rules 643apply to each result separately. 644 645 Functions can have one or several input arguments. An input point is 646a mapping from these input arguments to the set of the MPFR numbers. 647When none of its components are NaN, an input point can also be seen as 648a tuple in the extended real numbers (the set of the real numbers with 649both infinities). 650 651 When the input point is in the domain of the mathematical function, 652the result is rounded as described in *note Rounding:: (but see below 653for the specification of the sign of an exact zero). Otherwise the 654general rules from this section apply unless stated otherwise in the 655description of the MPFR function (*note MPFR Interface::). 656 657 When the input point is not in the domain of the mathematical 658function but is in its closure in the extended real numbers and the 659function can be extended by continuity, the result is the obtained 660limit. Examples: ���mpfr_hypot��� on (+Inf,0) gives +Inf. But ���mpfr_pow��� 661cannot be defined on (1,+Inf) using this rule, as one can find sequences 662(X_N,Y_N) such that X_N goes to 1, Y_N goes to +Inf and X_N to the Y_N 663goes to any positive value when N goes to the infinity. 664 665 When the input point is in the closure of the domain of the 666mathematical function and an input argument is +0 (resp. ���0), one 667considers the limit when the corresponding argument approaches 0 from 668above (resp. below), if possible. If the limit is not defined (e.g., 669���mpfr_sqrt��� and ���mpfr_log��� on ���0), the behavior is specified in the 670description of the MPFR function, but must be consistent with the rule 671from the above paragraph (e.g., ���mpfr_log��� on ��0 gives ���Inf). 672 673 When the result is equal to 0, its sign is determined by considering 674the limit as if the input point were not in the domain: If one 675approaches 0 from above (resp. below), the result is +0 (resp. ���0); for 676example, ���mpfr_sin��� on ���0 gives ���0 and ���mpfr_acos��� on 1 gives +0 (in all 677rounding modes). In the other cases, the sign is specified in the 678description of the MPFR function; for example ���mpfr_max��� on ���0 and +0 679gives +0. 680 681 When the input point is not in the closure of the domain of the 682function, the result is NaN. Example: ���mpfr_sqrt��� on ���17 gives NaN. 683 684 When an input argument is NaN, the result is NaN, possibly except 685when a partial function is constant on the finite floating-point 686numbers; such a case is always explicitly specified in *note MPFR 687Interface::. Example: ���mpfr_hypot��� on (NaN,0) gives NaN, but 688���mpfr_hypot��� on (NaN,+Inf) gives +Inf (as specified in *note 689Transcendental Functions::), since for any finite or infinite input X, 690���mpfr_hypot��� on (X,+Inf) gives +Inf. 691 692 MPFR also tries to follow the specifications of the IEEE 754 standard 693on special values (IEEE 754 agree with the above rules in most cases). 694Any difference with IEEE 754 that is not explicitly mentioned, other 695than those due to the single NaN, is unintended and might be regarded as 696a bug. See also *note MPFR and the IEEE 754 Standard::. 697 698 699File: mpfr.info, Node: Exceptions, Next: Memory Handling, Prev: Floating-Point Values on Special Numbers, Up: MPFR Basics 700 7014.6 Exceptions 702============== 703 704MPFR defines a global (or per-thread) flag for each supported exception. 705A macro evaluating to a power of two is associated with each flag and 706exception, in order to be able to specify a group of flags (or a mask) 707by OR���ing such macros. 708 709 Flags can be cleared (lowered), set (raised), and tested by functions 710described in *note Exception Related Functions::. 711 712 The supported exceptions are listed below. The macro associated with 713each exception is in parentheses. 714 715 ��� Underflow (���MPFR_FLAGS_UNDERFLOW���): An underflow occurs when the 716 exact result of a function is a non-zero real number and the result 717 obtained after the rounding, assuming an unbounded exponent range 718 (for the rounding), has an exponent smaller than the minimum value 719 of the current exponent range. (In the round-to-nearest mode, the 720 halfway case is rounded toward zero.) 721 722 Note: This is not the single possible definition of the underflow. 723 MPFR chooses to consider the underflow _after_ rounding. The 724 underflow before rounding can also be defined. For instance, 725 consider a function that has the exact result 7 multiplied by two 726 to the power E ��� 4, where E is the smallest exponent (for a 727 significand between 1/2 and 1), with a 2-bit target precision and 728 rounding toward positive infinity. The exact result has the 729 exponent E ��� 1. With the underflow before rounding, such a 730 function call would yield an underflow, as E ��� 1 is outside the 731 current exponent range. However, MPFR first considers the rounded 732 result assuming an unbounded exponent range. The exact result 733 cannot be represented exactly in precision 2, and here, it is 734 rounded to 0.5 times 2 to E, which is representable in the current 735 exponent range. As a consequence, this will not yield an underflow 736 in MPFR. 737 738 ��� Overflow (���MPFR_FLAGS_OVERFLOW���): An overflow occurs when the exact 739 result of a function is a non-zero real number and the result 740 obtained after the rounding, assuming an unbounded exponent range 741 (for the rounding), has an exponent larger than the maximum value 742 of the current exponent range. In the round-to-nearest mode, the 743 result is infinite. Note: unlike the underflow case, there is only 744 one possible definition of overflow here. 745 746 ��� Divide-by-zero (���MPFR_FLAGS_DIVBY0���): An exact infinite result is 747 obtained from finite inputs. 748 749 ��� NaN (���MPFR_FLAGS_NAN���): A NaN exception occurs when the result of a 750 function is NaN. 751 752 ��� Inexact (���MPFR_FLAGS_INEXACT���): An inexact exception occurs when 753 the result of a function cannot be represented exactly and must be 754 rounded. 755 756 ��� Range error (���MPFR_FLAGS_ERANGE���): A range exception occurs when a 757 function that does not return a MPFR number (such as comparisons 758 and conversions to an integer) has an invalid result (e.g., an 759 argument is NaN in ���mpfr_cmp���, or a conversion to an integer cannot 760 be represented in the target type). 761 762 Moreover, the group consisting of all the flags is represented by the 763���MPFR_FLAGS_ALL��� macro (if new flags are added in future MPFR versions, 764they will be added to this macro too). 765 766 Differences with the ISO C99 standard: 767 768 ��� In C, only quiet NaNs are specified, and a NaN propagation does not 769 raise an invalid exception. Unless explicitly stated otherwise, 770 MPFR sets the NaN flag whenever a NaN is generated, even when a NaN 771 is propagated (e.g., in NaN + NaN), as if all NaNs were signaling. 772 773 ��� An invalid exception in C corresponds to either a NaN exception or 774 a range error in MPFR. 775 776 777File: mpfr.info, Node: Memory Handling, Next: Getting the Best Efficiency Out of MPFR, Prev: Exceptions, Up: MPFR Basics 778 7794.7 Memory Handling 780=================== 781 782MPFR functions may create caches, e.g., when computing constants such as 783Pi, either because the user has called a function like ���mpfr_const_pi��� 784directly or because such a function was called internally by the MPFR 785library itself to compute some other function. When more precision is 786needed, the value is automatically recomputed; a minimum of 10% increase 787of the precision is guaranteed to avoid too many recomputations. 788 789 MPFR functions may also create thread-local pools for internal use to 790avoid the cost of memory allocation. The pools can be freed with 791���mpfr_free_pool��� (but with a default MPFR build, they should not take 792much memory, as the allocation size is limited). 793 794 At any time, the user can free various caches and pools with 795���mpfr_free_cache��� and ���mpfr_free_cache2���. It is strongly advised to 796free thread-local caches before terminating a thread, and all caches 797before exiting when using tools like ���valgrind��� (to avoid memory leaks 798being reported). 799 800 MPFR allocates its memory either on the stack (for temporary memory 801only) or with the same allocator as the one configured for GMP: *note 802(gmp.info)Custom Allocation::. This means that the application must 803make sure that data allocated with the current allocator will not be 804reallocated or freed with a new allocator. So, in practice, if an 805application needs to change the allocator with 806���mp_set_memory_functions���, it should first free all data allocated with 807the current allocator: for its own data, with ���mpfr_clear���, etc.; for 808the caches and pools, with ���mpfr_mp_memory_cleanup��� in all threads where 809MPFR is potentially used. This function is currently equivalent to 810���mpfr_free_cache���, but ���mpfr_mp_memory_cleanup��� is the recommended way 811in case the allocation method changes in the future (for instance, one 812may choose to allocate the caches for floating-point constants with 813���malloc��� to avoid freeing them if the allocator changes). Developers 814should also be aware that MPFR may also be used indirectly by libraries, 815so that libraries based on MPFR should provide a clean-up function 816calling ���mpfr_mp_memory_cleanup��� and/or warn their users about this 817issue. 818 819 Note: For multithreaded applications, the allocator must be valid in 820all threads where MPFR may be used; data allocated in one thread may be 821reallocated and/or freed in some other thread. 822 823 MPFR internal data such as flags, the exponent range, the default 824precision, and the default rounding mode are either global (if MPFR has 825not been compiled as thread safe) or per-thread (thread-local storage, 826TLS). The initial values of TLS data after a thread is created entirely 827depend on the compiler and thread implementation (MPFR simply does a 828conventional variable initialization, the variables being declared with 829an implementation-defined TLS specifier). 830 831 Writers of libraries using MPFR should be aware that the application 832and/or another library used by the application may also use MPFR, so 833that changing the exponent range, the default precision, or the default 834rounding mode may have an effect on this other use of MPFR since these 835data are not duplicated (unless they are in a different thread). 836Therefore any such value changed in a library function should be 837restored before the function returns (unless the purpose of the function 838is to do such a change). Writers of software using MPFR should also be 839careful when changing such a value if they use a library using MPFR 840(directly or indirectly), in order to make sure that such a change is 841compatible with the library. 842 843 844File: mpfr.info, Node: Getting the Best Efficiency Out of MPFR, Prev: Memory Handling, Up: MPFR Basics 845 8464.8 Getting the Best Efficiency Out of MPFR 847=========================================== 848 849Here are a few hints to get the best efficiency out of MPFR: 850 851 ��� you should avoid allocating and clearing variables. Reuse 852 variables whenever possible, allocate or clear outside of loops, 853 pass temporary variables to subroutines instead of allocating them 854 inside the subroutines; 855 856 ��� use ���mpfr_swap��� instead of ���mpfr_set��� whenever possible. This will 857 avoid copying the significands; 858 859 ��� avoid using MPFR from C++, or make sure your C++ interface does not 860 perform unnecessary allocations or copies. Slowdowns of up to a 861 factor 15 have been observed on some applications with a C++ 862 interface; 863 864 ��� MPFR functions work in-place: to compute ���a = a + b��� you don���t need 865 an auxiliary variable, you can directly write ���mpfr_add (a, a, b, 866 ...)���. 867 868 869File: mpfr.info, Node: MPFR Interface, Next: API Compatibility, Prev: MPFR Basics, Up: Top 870 8715 MPFR Interface 872**************** 873 874The floating-point functions expect arguments of type ���mpfr_t���. 875 876 The MPFR floating-point functions have an interface that is similar 877to the GNU MP functions. The function prefix for floating-point 878operations is ���mpfr_���. 879 880 The user has to specify the precision of each variable. A 881computation that assigns a variable will take place with the precision 882of the assigned variable; the cost of that computation should not depend 883on the precision of variables used as input (on average). 884 885 The semantics of a calculation in MPFR is specified as follows: 886Compute the requested operation exactly (with ���infinite accuracy���), and 887round the result to the precision of the destination variable, with the 888given rounding mode. The MPFR floating-point functions are intended to 889be a smooth extension of the IEEE 754 arithmetic. The results obtained 890on a given computer are identical to those obtained on a computer with a 891different word size, or with a different compiler or operating system. 892 893 MPFR _does not keep track_ of the accuracy of a computation. This is 894left to the user or to a higher layer (for example, the MPFI library for 895interval arithmetic). As a consequence, if two variables are used to 896store only a few significant bits, and their product is stored in a 897variable with a large precision, then MPFR will still compute the result 898with full precision. 899 900 The value of the standard C macro ���errno��� may be set to non-zero 901after calling any MPFR function or macro, whether or not there is an 902error. Except when documented, MPFR will not set ���errno���, but functions 903called by the MPFR code (libc functions, memory allocator, etc.) may do 904so. 905 906* Menu: 907 908* Initialization Functions:: 909* Assignment Functions:: 910* Combined Initialization and Assignment Functions:: 911* Conversion Functions:: 912* Arithmetic Functions:: 913* Comparison Functions:: 914* Transcendental Functions:: 915* Input and Output Functions:: 916* Formatted Output Functions:: 917* Integer and Remainder Related Functions:: 918* Rounding-Related Functions:: 919* Miscellaneous Functions:: 920* Exception Related Functions:: 921* Memory Handling Functions:: 922* Compatibility with MPF:: 923* Custom Interface:: 924* Internals:: 925 926 927File: mpfr.info, Node: Initialization Functions, Next: Assignment Functions, Prev: MPFR Interface, Up: MPFR Interface 928 9295.1 Initialization Functions 930============================ 931 932An ���mpfr_t��� object must be initialized before storing the first value in 933it. The functions ���mpfr_init��� and ���mpfr_init2��� are used for that 934purpose. 935 936 -- Function: void mpfr_init2 (mpfr_t X, mpfr_prec_t PREC) 937 Initialize X, set its precision to be *exactly* PREC bits and its 938 value to NaN. (Warning: the corresponding MPF function initializes 939 to zero instead.) 940 941 Normally, a variable should be initialized once only or at least be 942 cleared, using ���mpfr_clear���, between initializations. To change 943 the precision of a variable that has already been initialized, use 944 ���mpfr_set_prec��� or ���mpfr_prec_round���; note that if the precision is 945 decreased, the unused memory will not be freed, so that it may be 946 wise to choose a large enough initial precision in order to avoid 947 reallocations. The precision PREC must be an integer between 948 ���MPFR_PREC_MIN��� and ���MPFR_PREC_MAX��� (otherwise the behavior is 949 undefined). 950 951 -- Function: void mpfr_inits2 (mpfr_prec_t PREC, mpfr_t X, ...) 952 Initialize all the ���mpfr_t��� variables of the given variable 953 argument ���va_list���, set their precision to be *exactly* PREC bits 954 and their value to NaN. See ���mpfr_init2��� for more details. The 955 ���va_list��� is assumed to be composed only of type ���mpfr_t��� (or 956 equivalently ���mpfr_ptr���). It begins from X, and ends when it 957 encounters a null pointer (whose type must also be ���mpfr_ptr���). 958 959 -- Function: void mpfr_clear (mpfr_t X) 960 Free the space occupied by the significand of X. Make sure to call 961 this function for all ���mpfr_t��� variables when you are done with 962 them. 963 964 -- Function: void mpfr_clears (mpfr_t X, ...) 965 Free the space occupied by all the ���mpfr_t��� variables of the given 966 ���va_list���. See ���mpfr_clear��� for more details. The ���va_list��� is 967 assumed to be composed only of type ���mpfr_t��� (or equivalently 968 ���mpfr_ptr���). It begins from X, and ends when it encounters a null 969 pointer (whose type must also be ���mpfr_ptr���). 970 971 Here is an example of how to use multiple initialization functions 972(since ���NULL��� is not necessarily defined in this context, we use 973���(mpfr_ptr) 0��� instead, but ���(mpfr_ptr) NULL��� is also correct). 974 975 { 976 mpfr_t x, y, z, t; 977 mpfr_inits2 (256, x, y, z, t, (mpfr_ptr) 0); 978 ... 979 mpfr_clears (x, y, z, t, (mpfr_ptr) 0); 980 } 981 982 -- Function: void mpfr_init (mpfr_t X) 983 Initialize X, set its precision to the default precision, and set 984 its value to NaN. The default precision can be changed by a call 985 to ���mpfr_set_default_prec���. 986 987 Warning! In a given program, some other libraries might change the 988 default precision and not restore it. Thus it is safer to use 989 ���mpfr_init2���. 990 991 -- Function: void mpfr_inits (mpfr_t X, ...) 992 Initialize all the ���mpfr_t��� variables of the given ���va_list���, set 993 their precision to the default precision and their value to NaN. 994 See ���mpfr_init��� for more details. The ���va_list��� is assumed to be 995 composed only of type ���mpfr_t��� (or equivalently ���mpfr_ptr���). It 996 begins from X, and ends when it encounters a null pointer (whose 997 type must also be ���mpfr_ptr���). 998 999 Warning! In a given program, some other libraries might change the 1000 default precision and not restore it. Thus it is safer to use 1001 ���mpfr_inits2���. 1002 1003 -- Macro: MPFR_DECL_INIT (NAME, PREC) 1004 This macro declares NAME as an automatic variable of type ���mpfr_t���, 1005 initializes it and sets its precision to be *exactly* PREC bits and 1006 its value to NaN. NAME must be a valid identifier. You must use 1007 this macro in the declaration section. This macro is much faster 1008 than using ���mpfr_init2��� but has some drawbacks: 1009 1010 ��� You *must not* call ���mpfr_clear��� with variables created with 1011 this macro (the storage is allocated at the point of 1012 declaration and deallocated when the brace-level is exited). 1013 1014 ��� You *cannot* change their precision. 1015 1016 ��� You *should not* create variables with huge precision with 1017 this macro. 1018 1019 ��� Your compiler must support ���Non-Constant Initializers��� 1020 (standard in C++ and ISO C99) and ���Token Pasting��� (standard in 1021 ISO C90). If PREC is not a constant expression, your compiler 1022 must support ���variable-length automatic arrays��� (standard in 1023 ISO C99). GCC 2.95.3 and above supports all these features. 1024 If you compile your program with GCC in C90 mode and with 1025 ���-pedantic���, you may want to define the ���MPFR_USE_EXTENSION��� 1026 macro to avoid warnings due to the ���MPFR_DECL_INIT��� 1027 implementation. 1028 1029 -- Function: void mpfr_set_default_prec (mpfr_prec_t PREC) 1030 Set the default precision to be *exactly* PREC bits, where PREC can 1031 be any integer between ���MPFR_PREC_MIN��� and ���MPFR_PREC_MAX���. The 1032 precision of a variable means the number of bits used to store its 1033 significand. All subsequent calls to ���mpfr_init��� or ���mpfr_inits��� 1034 will use this precision, but previously initialized variables are 1035 unaffected. The default precision is set to 53 bits initially. 1036 1037 Note: when MPFR is built with the ���--enable-thread-safe��� configure 1038 option, the default precision is local to each thread. *Note 1039 Memory Handling::, for more information. 1040 1041 -- Function: mpfr_prec_t mpfr_get_default_prec (void) 1042 Return the current default MPFR precision in bits. See the 1043 documentation of ���mpfr_set_default_prec���. 1044 1045 Here is an example on how to initialize floating-point variables: 1046 1047 { 1048 mpfr_t x, y; 1049 mpfr_init (x); /* use default precision */ 1050 mpfr_init2 (y, 256); /* precision _exactly_ 256 bits */ 1051 ... 1052 /* When the program is about to exit, do ... */ 1053 mpfr_clear (x); 1054 mpfr_clear (y); 1055 mpfr_free_cache (); /* free the cache for constants like pi */ 1056 } 1057 1058 The following functions are useful for changing the precision during 1059a calculation. A typical use would be for adjusting the precision 1060gradually in iterative algorithms like Newton-Raphson, making the 1061computation precision closely match the actual accurate part of the 1062numbers. 1063 1064 -- Function: void mpfr_set_prec (mpfr_t X, mpfr_prec_t PREC) 1065 Set the precision of X to be *exactly* PREC bits, and set its value 1066 to NaN. The previous value stored in X is lost. It is equivalent 1067 to a call to ���mpfr_clear(X)��� followed by a call to ���mpfr_init2(X, 1068 PREC)���, but more efficient as no allocation is done in case the 1069 current allocated space for the significand of X is enough. The 1070 precision PREC can be any integer between ���MPFR_PREC_MIN��� and 1071 ���MPFR_PREC_MAX���. In case you want to keep the previous value 1072 stored in X, use ���mpfr_prec_round��� instead. 1073 1074 Warning! You must not use this function if X was initialized with 1075 ���MPFR_DECL_INIT��� or with ���mpfr_custom_init_set��� (*note Custom 1076 Interface::). 1077 1078 -- Function: mpfr_prec_t mpfr_get_prec (mpfr_t X) 1079 Return the precision of X, i.e., the number of bits used to store 1080 its significand. 1081 1082 1083File: mpfr.info, Node: Assignment Functions, Next: Combined Initialization and Assignment Functions, Prev: Initialization Functions, Up: MPFR Interface 1084 10855.2 Assignment Functions 1086======================== 1087 1088These functions assign new values to already initialized floats (*note 1089Initialization Functions::). 1090 1091 -- Function: int mpfr_set (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1092 -- Function: int mpfr_set_ui (mpfr_t ROP, unsigned long int OP, 1093 mpfr_rnd_t RND) 1094 -- Function: int mpfr_set_si (mpfr_t ROP, long int OP, mpfr_rnd_t RND) 1095 -- Function: int mpfr_set_uj (mpfr_t ROP, uintmax_t OP, mpfr_rnd_t RND) 1096 -- Function: int mpfr_set_sj (mpfr_t ROP, intmax_t OP, mpfr_rnd_t RND) 1097 -- Function: int mpfr_set_flt (mpfr_t ROP, float OP, mpfr_rnd_t RND) 1098 -- Function: int mpfr_set_d (mpfr_t ROP, double OP, mpfr_rnd_t RND) 1099 -- Function: int mpfr_set_ld (mpfr_t ROP, long double OP, mpfr_rnd_t 1100 RND) 1101 -- Function: int mpfr_set_float128 (mpfr_t ROP, _Float128 OP, 1102 mpfr_rnd_t RND) 1103 -- Function: int mpfr_set_decimal64 (mpfr_t ROP, _Decimal64 OP, 1104 mpfr_rnd_t RND) 1105 -- Function: int mpfr_set_decimal128 (mpfr_t ROP, _Decimal128 OP, 1106 mpfr_rnd_t RND) 1107 -- Function: int mpfr_set_z (mpfr_t ROP, mpz_t OP, mpfr_rnd_t RND) 1108 -- Function: int mpfr_set_q (mpfr_t ROP, mpq_t OP, mpfr_rnd_t RND) 1109 -- Function: int mpfr_set_f (mpfr_t ROP, mpf_t OP, mpfr_rnd_t RND) 1110 Set the value of ROP from OP, rounded toward the given direction 1111 RND. Note that the input 0 is converted to +0 by ���mpfr_set_ui���, 1112 ���mpfr_set_si���, ���mpfr_set_uj���, ���mpfr_set_sj���, ���mpfr_set_z���, 1113 ���mpfr_set_q��� and ���mpfr_set_f���, regardless of the rounding mode. 1114 The ���mpfr_set_float128��� function is built only with the configure 1115 option ���--enable-float128���, which requires the compiler or system 1116 provides the ���_Float128��� data type (GCC 4.3 or later supports this 1117 data type); to use ���mpfr_set_float128���, one should define the macro 1118 ���MPFR_WANT_FLOAT128��� before including ���mpfr.h���. If the system does 1119 not support the IEEE 754 standard, ���mpfr_set_flt���, ���mpfr_set_d���, 1120 ���mpfr_set_ld���, ���mpfr_set_decimal64��� and ���mpfr_set_decimal128��� might 1121 not preserve the signed zeros (and in any case they don���t preserve 1122 the sign bit of NaN). The ���mpfr_set_decimal64��� and 1123 ���mpfr_set_decimal128��� functions are built only with the configure 1124 option ���--enable-decimal-float���, and when the compiler or system 1125 provides the ���_Decimal64��� and ���_Decimal128��� data type; to use those 1126 functions, one should define the macro ���MPFR_WANT_DECIMAL_FLOATS��� 1127 before including ���mpfr.h���. ���mpfr_set_q��� might fail if the 1128 numerator (or the denominator) cannot be represented as a ���mpfr_t���. 1129 1130 For ���mpfr_set���, the sign of a NaN is propagated in order to mimic 1131 the IEEE 754 ���copy��� operation. But contrary to IEEE 754, the NaN 1132 flag is set as usual. 1133 1134 Note: If you want to store a floating-point constant to a ���mpfr_t���, 1135 you should use ���mpfr_set_str��� (or one of the MPFR constant 1136 functions, such as ���mpfr_const_pi��� for Pi) instead of 1137 ���mpfr_set_flt���, ���mpfr_set_d���, ���mpfr_set_ld���, ���mpfr_set_decimal64��� 1138 or ���mpfr_set_decimal128���. Otherwise the floating-point constant 1139 will be first converted into a reduced-precision (e.g., 53-bit) 1140 binary (or decimal, for ���mpfr_set_decimal64��� and 1141 ���mpfr_set_decimal128���) number before MPFR can work with it. 1142 1143 -- Function: int mpfr_set_ui_2exp (mpfr_t ROP, unsigned long int OP, 1144 mpfr_exp_t E, mpfr_rnd_t RND) 1145 -- Function: int mpfr_set_si_2exp (mpfr_t ROP, long int OP, mpfr_exp_t 1146 E, mpfr_rnd_t RND) 1147 -- Function: int mpfr_set_uj_2exp (mpfr_t ROP, uintmax_t OP, intmax_t 1148 E, mpfr_rnd_t RND) 1149 -- Function: int mpfr_set_sj_2exp (mpfr_t ROP, intmax_t OP, intmax_t E, 1150 mpfr_rnd_t RND) 1151 -- Function: int mpfr_set_z_2exp (mpfr_t ROP, mpz_t OP, mpfr_exp_t E, 1152 mpfr_rnd_t RND) 1153 Set the value of ROP from OP multiplied by two to the power E, 1154 rounded toward the given direction RND. Note that the input 0 is 1155 converted to +0. 1156 1157 -- Function: int mpfr_set_str (mpfr_t ROP, const char *S, int BASE, 1158 mpfr_rnd_t RND) 1159 Set ROP to the value of the string S in base BASE, rounded in the 1160 direction RND. See the documentation of ���mpfr_strtofr��� for a 1161 detailed description of BASE (with its special value 0) and the 1162 valid string formats. Contrary to ���mpfr_strtofr���, ���mpfr_set_str��� 1163 requires the _whole_ string to represent a valid floating-point 1164 number. 1165 1166 The meaning of the return value differs from other MPFR functions: 1167 it is 0 if the entire string up to the final null character is a 1168 valid number in base BASE; otherwise it is ���1, and ROP may have 1169 changed (users interested in the *note ternary value:: should use 1170 ���mpfr_strtofr��� instead). 1171 1172 Note: it is preferable to use ���mpfr_strtofr��� if one wants to 1173 distinguish between an infinite ROP value coming from an infinite S 1174 or from an overflow. 1175 1176 -- Function: int mpfr_strtofr (mpfr_t ROP, const char *NPTR, char 1177 **ENDPTR, int BASE, mpfr_rnd_t RND) 1178 Read a floating-point number from a string NPTR in base BASE, 1179 rounded in the direction RND; BASE must be either 0 (to detect the 1180 base, as described below) or a number from 2 to 62 (otherwise the 1181 behavior is undefined). If NPTR starts with valid data, the result 1182 is stored in ROP and ���*ENDPTR��� points to the character just after 1183 the valid data (if ENDPTR is not a null pointer); otherwise ROP is 1184 set to zero (for consistency with ���strtod���) and the value of NPTR 1185 is stored in the location referenced by ENDPTR (if ENDPTR is not a 1186 null pointer). The usual ternary value is returned. 1187 1188 Parsing follows the standard C ���strtod��� function with some 1189 extensions. After optional leading whitespace, one has a subject 1190 sequence consisting of an optional sign (���+��� or ���-���), and either 1191 numeric data or special data. The subject sequence is defined as 1192 the longest initial subsequence of the input string, starting with 1193 the first non-whitespace character, that is of the expected form. 1194 1195 The form of numeric data is a non-empty sequence of significand 1196 digits with an optional decimal-point character, and an optional 1197 exponent consisting of an exponent prefix followed by an optional 1198 sign and a non-empty sequence of decimal digits. A significand 1199 digit is either a decimal digit or a Latin letter (62 possible 1200 characters), with ���A��� = 10, ���B��� = 11, ..., ���Z��� = 35; case is 1201 ignored in bases less than or equal to 36, in bases larger than 36, 1202 ���a��� = 36, ���b��� = 37, ..., ���z��� = 61. The value of a significand 1203 digit must be strictly less than the base. The decimal-point 1204 character can be either the one defined by the current locale or 1205 the period (the first one is accepted for consistency with the C 1206 standard and the practice, the second one is accepted to allow the 1207 programmer to provide MPFR numbers from strings in a way that does 1208 not depend on the current locale). The exponent prefix can be ���e��� 1209 or ���E��� for bases up to 10, or ���@��� in any base; it indicates a 1210 multiplication by a power of the base. In bases 2 and 16, the 1211 exponent prefix can also be ���p��� or ���P���, in which case the exponent, 1212 called _binary exponent_, indicates a multiplication by a power of 1213 2 instead of the base (there is a difference only for base 16); in 1214 base 16 for example ���1p2��� represents 4 whereas ���1@2��� represents 1215 256. The value of an exponent is always written in base 10. 1216 1217 If the argument BASE is 0, then the base is automatically detected 1218 as follows. If the significand starts with ���0b��� or ���0B���, base 2 is 1219 assumed. If the significand starts with ���0x��� or ���0X���, base 16 is 1220 assumed. Otherwise base 10 is assumed. 1221 1222 Note: The exponent (if present) must contain at least a digit. 1223 Otherwise the possible exponent prefix and sign are not part of the 1224 number (which ends with the significand). Similarly, if ���0b���, 1225 ���0B���, ���0x��� or ���0X��� is not followed by a binary/hexadecimal digit, 1226 then the subject sequence stops at the character ���0���, thus 0 is 1227 read. 1228 1229 Special data (for infinities and NaN) can be ���@inf@��� or 1230 ���@nan@(n-char-sequence-opt)���, and if BASE <= 16, it can also be 1231 ���infinity���, ���inf���, ���nan��� or ���nan(n-char-sequence-opt)���, all case 1232 insensitive with the rules of the C locale. An 1233 ���n-char-sequence-opt��� is a possibly empty string containing only 1234 digits, Latin letters and the underscore (0, 1, 2, ..., 9, a, b, 1235 ..., z, A, B, ..., Z, _). Note: one has an optional sign for all 1236 data, even NaN. For example, ���-@nAn@(This_Is_Not_17)��� is a valid 1237 representation for NaN in base 17. 1238 1239 -- Function: void mpfr_set_nan (mpfr_t X) 1240 -- Function: void mpfr_set_inf (mpfr_t X, int SIGN) 1241 -- Function: void mpfr_set_zero (mpfr_t X, int SIGN) 1242 Set the variable X to NaN (Not-a-Number), infinity or zero 1243 respectively. In ���mpfr_set_inf��� or ���mpfr_set_zero���, X is set to 1244 positive infinity (+Inf) or positive zero (+0) iff SIGN is 1245 non-negative; in ���mpfr_set_nan���, the sign bit of the result is 1246 unspecified. 1247 1248 -- Function: void mpfr_swap (mpfr_t X, mpfr_t Y) 1249 Swap the structures pointed to by X and Y. In particular, the 1250 values are exchanged without rounding (this may be different from 1251 three ���mpfr_set��� calls using a third auxiliary variable). 1252 1253 Warning! Since the precisions are exchanged, this will affect 1254 future assignments. Moreover, since the significand pointers are 1255 also exchanged, you must not use this function if the allocation 1256 method used for X and/or Y does not permit it. This is the case 1257 when X and/or Y were declared and initialized with 1258 ���MPFR_DECL_INIT���, and possibly with ���mpfr_custom_init_set��� (*note 1259 Custom Interface::). 1260 1261 1262File: mpfr.info, Node: Combined Initialization and Assignment Functions, Next: Conversion Functions, Prev: Assignment Functions, Up: MPFR Interface 1263 12645.3 Combined Initialization and Assignment Functions 1265==================================================== 1266 1267 -- Macro: int mpfr_init_set (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1268 -- Macro: int mpfr_init_set_ui (mpfr_t ROP, unsigned long int OP, 1269 mpfr_rnd_t RND) 1270 -- Macro: int mpfr_init_set_si (mpfr_t ROP, long int OP, mpfr_rnd_t 1271 RND) 1272 -- Macro: int mpfr_init_set_d (mpfr_t ROP, double OP, mpfr_rnd_t RND) 1273 -- Macro: int mpfr_init_set_ld (mpfr_t ROP, long double OP, mpfr_rnd_t 1274 RND) 1275 -- Macro: int mpfr_init_set_z (mpfr_t ROP, mpz_t OP, mpfr_rnd_t RND) 1276 -- Macro: int mpfr_init_set_q (mpfr_t ROP, mpq_t OP, mpfr_rnd_t RND) 1277 -- Macro: int mpfr_init_set_f (mpfr_t ROP, mpf_t OP, mpfr_rnd_t RND) 1278 Initialize ROP and set its value from OP, rounded in the direction 1279 RND. The precision of ROP will be taken from the active default 1280 precision, as set by ���mpfr_set_default_prec���. 1281 1282 -- Function: int mpfr_init_set_str (mpfr_t X, const char *S, int BASE, 1283 mpfr_rnd_t RND) 1284 Initialize X and set its value from the string S in base BASE, 1285 rounded in the direction RND. See ���mpfr_set_str���. 1286 1287 1288File: mpfr.info, Node: Conversion Functions, Next: Arithmetic Functions, Prev: Combined Initialization and Assignment Functions, Up: MPFR Interface 1289 12905.4 Conversion Functions 1291======================== 1292 1293 -- Function: float mpfr_get_flt (mpfr_t OP, mpfr_rnd_t RND) 1294 -- Function: double mpfr_get_d (mpfr_t OP, mpfr_rnd_t RND) 1295 -- Function: long double mpfr_get_ld (mpfr_t OP, mpfr_rnd_t RND) 1296 -- Function: _Float128 mpfr_get_float128 (mpfr_t OP, mpfr_rnd_t RND) 1297 -- Function: _Decimal64 mpfr_get_decimal64 (mpfr_t OP, mpfr_rnd_t RND) 1298 -- Function: _Decimal128 mpfr_get_decimal128 (mpfr_t OP, mpfr_rnd_t 1299 RND) 1300 Convert OP to a ���float��� (respectively ���double���, ���long double���, 1301 ���_Decimal64���, or ���_Decimal128���) using the rounding mode RND. If OP 1302 is NaN, some NaN (either quiet or signaling) or the result of 1303 0.0/0.0 is returned (the sign bit is not preserved). If OP is 1304 ��Inf, an infinity of the same sign or the result of ��1.0/0.0 is 1305 returned. If OP is zero, these functions return a zero, trying to 1306 preserve its sign, if possible. The ���mpfr_get_float128���, 1307 ���mpfr_get_decimal64��� and ���mpfr_get_decimal128��� functions are built 1308 only under some conditions: see the documentation of 1309 ���mpfr_set_float128���, ���mpfr_set_decimal64��� and ���mpfr_set_decimal128��� 1310 respectively. 1311 1312 -- Function: long int mpfr_get_si (mpfr_t OP, mpfr_rnd_t RND) 1313 -- Function: unsigned long int mpfr_get_ui (mpfr_t OP, mpfr_rnd_t RND) 1314 -- Function: intmax_t mpfr_get_sj (mpfr_t OP, mpfr_rnd_t RND) 1315 -- Function: uintmax_t mpfr_get_uj (mpfr_t OP, mpfr_rnd_t RND) 1316 Convert OP to a ���long int���, an ���unsigned long int���, an ���intmax_t��� 1317 or an ���uintmax_t��� (respectively) after rounding it to an integer 1318 with respect to RND. If OP is NaN, 0 is returned and the _erange_ 1319 flag is set. If OP is too big for the return type, the function 1320 returns the maximum or the minimum of the corresponding C type, 1321 depending on the direction of the overflow; the _erange_ flag is 1322 set too. When there is no such range error, if the return value 1323 differs from OP, i.e., if OP is not an integer, the inexact flag is 1324 set. See also ���mpfr_fits_slong_p���, ���mpfr_fits_ulong_p���, 1325 ���mpfr_fits_intmax_p��� and ���mpfr_fits_uintmax_p���. 1326 1327 -- Function: double mpfr_get_d_2exp (long *EXP, mpfr_t OP, mpfr_rnd_t 1328 RND) 1329 -- Function: long double mpfr_get_ld_2exp (long *EXP, mpfr_t OP, 1330 mpfr_rnd_t RND) 1331 Return D and set EXP (formally, the value pointed to by EXP) such 1332 that 0.5 <= abs(D) < 1 and D times 2 raised to EXP equals OP 1333 rounded to double (resp. long double) precision, using the given 1334 rounding mode. If OP is zero, then a zero of the same sign (or an 1335 unsigned zero, if the implementation does not have signed zeros) is 1336 returned, and EXP is set to 0. If OP is NaN or an infinity, then 1337 the corresponding double precision (resp. long-double precision) 1338 value is returned, and EXP is undefined. 1339 1340 -- Function: int mpfr_frexp (mpfr_exp_t *EXP, mpfr_t Y, mpfr_t X, 1341 mpfr_rnd_t RND) 1342 Set EXP (formally, the value pointed to by EXP) and Y such that 1343 0.5 <= abs(Y) < 1 and Y times 2 raised to EXP equals X rounded to 1344 the precision of Y, using the given rounding mode. If X is zero, 1345 then Y is set to a zero of the same sign and EXP is set to 0. If X 1346 is NaN or an infinity, then Y is set to the same value and EXP is 1347 undefined. 1348 1349 -- Function: mpfr_exp_t mpfr_get_z_2exp (mpz_t ROP, mpfr_t OP) 1350 Put the scaled significand of OP (regarded as an integer, with the 1351 precision of OP) into ROP, and return the exponent EXP (which may 1352 be outside the current exponent range) such that OP exactly equals 1353 ROP times 2 raised to the power EXP. If OP is zero, the minimal 1354 exponent EMIN is returned. If OP is NaN or an infinity, the 1355 _erange_ flag is set, ROP is set to 0, and the minimal exponent 1356 EMIN is returned. The returned exponent may be less than the 1357 minimal exponent EMIN of MPFR numbers in the current exponent 1358 range; in case the exponent is not representable in the 1359 ���mpfr_exp_t��� type, the _erange_ flag is set and the minimal value 1360 of the ���mpfr_exp_t��� type is returned. 1361 1362 -- Function: int mpfr_get_z (mpz_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1363 Convert OP to a ���mpz_t���, after rounding it with respect to RND. If 1364 OP is NaN or an infinity, the _erange_ flag is set, ROP is set to 1365 0, and 0 is returned. Otherwise the return value is zero when ROP 1366 is equal to OP (i.e., when OP is an integer), positive when it is 1367 greater than OP, and negative when it is smaller than OP; moreover, 1368 if ROP differs from OP, i.e., if OP is not an integer, the inexact 1369 flag is set. 1370 1371 -- Function: void mpfr_get_q (mpq_t ROP, mpfr_t OP) 1372 Convert OP to a ���mpq_t���. If OP is NaN or an infinity, the _erange_ 1373 flag is set and ROP is set to 0. Otherwise the conversion is 1374 always exact. 1375 1376 -- Function: int mpfr_get_f (mpf_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1377 Convert OP to a ���mpf_t���, after rounding it with respect to RND. 1378 The _erange_ flag is set if OP is NaN or an infinity, which do not 1379 exist in MPF. If OP is NaN, then ROP is undefined. If OP is +Inf 1380 (resp. ���Inf), then ROP is set to the maximum (resp. minimum) value 1381 in the precision of the MPF number; if a future MPF version 1382 supports infinities, this behavior will be considered incorrect and 1383 will change (portable programs should assume that ROP is set either 1384 to this finite number or to an infinite number). Note that since 1385 MPFR currently has the same exponent type as MPF (but not with the 1386 same radix), the range of values is much larger in MPF than in 1387 MPFR, so that an overflow or underflow is not possible. 1388 1389 -- Function: size_t mpfr_get_str_ndigits (int B, mpfr_prec_t P) 1390 Return the minimal integer m such that any number of P bits, when 1391 output with m digits in radix B with rounding to nearest, can be 1392 recovered exactly when read again, still with rounding to nearest. 1393 More precisely, we have m = 1 + ceil(P times log(2)/log(B)), with P 1394 replaced by P ��� 1 if B is a power of 2. 1395 1396 The argument B must be in the range 2 to 62; this is the range of 1397 bases supported by the ���mpfr_get_str��� function. Note that contrary 1398 to the base argument of this function, negative values are not 1399 accepted. 1400 1401 -- Function: char * mpfr_get_str (char *STR, mpfr_exp_t *EXPPTR, int 1402 BASE, size_t N, mpfr_t OP, mpfr_rnd_t RND) 1403 Convert OP to a string of digits in base abs(BASE), with rounding 1404 in the direction RND, where N is either zero (see below) or the 1405 number of significant digits output in the string. The argument 1406 BASE may vary from 2 to 62 or from ���2 to ���36; otherwise the 1407 function does nothing and immediately returns a null pointer. 1408 1409 For BASE in the range 2 to 36, digits and lower-case letters are 1410 used; for ���2 to ���36, digits and upper-case letters are used; for 37 1411 to 62, digits, upper-case letters, and lower-case letters, in that 1412 significance order, are used. Warning! This implies that for 1413 BASE > 10, the successor of the digit 9 depends on BASE. This 1414 choice has been done for compatibility with GMP���s ���mpf_get_str��� 1415 function. Users who wish a more consistent behavior should write a 1416 simple wrapper. 1417 1418 If the input is NaN, then the returned string is ���@NaN@��� and the 1419 NaN flag is set. If the input is +Inf (resp. ���Inf), then the 1420 returned string is ���@Inf@��� (resp. ���-@Inf@���). 1421 1422 If the input number is a finite number, the exponent is written 1423 through the pointer EXPPTR (for input 0, the current minimal 1424 exponent is written); the type ���mpfr_exp_t��� is large enough to hold 1425 the exponent in all cases. 1426 1427 The generated string is a fraction, with an implicit radix point 1428 immediately to the left of the first digit. For example, the 1429 number ���3.1416 would be returned as ���-31416��� in the string and 1 1430 written at EXPPTR. If RND is to nearest, and OP is exactly in the 1431 middle of two consecutive possible outputs, the one with an even 1432 significand is chosen, where both significands are considered with 1433 the exponent of OP. Note that for an odd base, this may not 1434 correspond to an even last digit: for example, with 2 digits in 1435 base 7, (14) and a half is rounded to (15), which is 12 in decimal, 1436 (16) and a half is rounded to (20), which is 14 in decimal, and 1437 (26) and a half is rounded to (26), which is 20 in decimal. 1438 1439 If N is zero, the number of digits of the significand is taken as 1440 ���mpfr_get_str_ndigits (BASE, P)���, where P is the precision of OP 1441 (*note mpfr_get_str_ndigits::). 1442 1443 If STR is a null pointer, space for the significand is allocated 1444 using the allocation function (*note Memory Handling::) and a 1445 pointer to the string is returned (unless the base is invalid). To 1446 free the returned string, you must use ���mpfr_free_str���. 1447 1448 If STR is not a null pointer, it should point to a block of storage 1449 large enough for the significand. A safe block size (sufficient 1450 for any value) is max(N + 2, 7) if N is not zero; if N is zero, 1451 replace it by ���mpfr_get_str_ndigits (BASE, P)���, where P is the 1452 precision of OP, as mentioned above. The extra two bytes are for a 1453 possible minus sign, and for the terminating null character, and 1454 the value 7 accounts for ���-@Inf@��� plus the terminating null 1455 character. The pointer to the string STR is returned (unless the 1456 base is invalid). 1457 1458 Like in usual functions, the inexact flag is set iff the result is 1459 inexact. 1460 1461 -- Function: void mpfr_free_str (char *STR) 1462 Free a string allocated by ���mpfr_get_str��� using the unallocation 1463 function (*note Memory Handling::). The block is assumed to be 1464 ���strlen(STR)+1��� bytes. 1465 1466 -- Function: int mpfr_fits_ulong_p (mpfr_t OP, mpfr_rnd_t RND) 1467 -- Function: int mpfr_fits_slong_p (mpfr_t OP, mpfr_rnd_t RND) 1468 -- Function: int mpfr_fits_uint_p (mpfr_t OP, mpfr_rnd_t RND) 1469 -- Function: int mpfr_fits_sint_p (mpfr_t OP, mpfr_rnd_t RND) 1470 -- Function: int mpfr_fits_ushort_p (mpfr_t OP, mpfr_rnd_t RND) 1471 -- Function: int mpfr_fits_sshort_p (mpfr_t OP, mpfr_rnd_t RND) 1472 -- Function: int mpfr_fits_uintmax_p (mpfr_t OP, mpfr_rnd_t RND) 1473 -- Function: int mpfr_fits_intmax_p (mpfr_t OP, mpfr_rnd_t RND) 1474 Return non-zero if OP would fit in the respective C data type, 1475 respectively ���unsigned long int���, ���long int���, ���unsigned int���, 1476 ���int���, ���unsigned short���, ���short���, ���uintmax_t���, ���intmax_t���, when 1477 rounded to an integer in the direction RND. For instance, with the 1478 ���MPFR_RNDU��� rounding mode on ���0.5, the result will be non-zero for 1479 all these functions. For ���MPFR_RNDF���, those functions return 1480 non-zero when it is guaranteed that the corresponding conversion 1481 function (for example ���mpfr_get_ui��� for ���mpfr_fits_ulong_p���), when 1482 called with faithful rounding, will always return a number that is 1483 representable in the corresponding type. As a consequence, for 1484 ���MPFR_RNDF���, ���mpfr_fits_ulong_p��� will return non-zero for a 1485 non-negative number less than or equal to ���ULONG_MAX���. 1486 1487 1488File: mpfr.info, Node: Arithmetic Functions, Next: Comparison Functions, Prev: Conversion Functions, Up: MPFR Interface 1489 14905.5 Arithmetic Functions 1491======================== 1492 1493 -- Function: int mpfr_add (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, 1494 mpfr_rnd_t RND) 1495 -- Function: int mpfr_add_ui (mpfr_t ROP, mpfr_t OP1, unsigned long int 1496 OP2, mpfr_rnd_t RND) 1497 -- Function: int mpfr_add_si (mpfr_t ROP, mpfr_t OP1, long int OP2, 1498 mpfr_rnd_t RND) 1499 -- Function: int mpfr_add_d (mpfr_t ROP, mpfr_t OP1, double OP2, 1500 mpfr_rnd_t RND) 1501 -- Function: int mpfr_add_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2, 1502 mpfr_rnd_t RND) 1503 -- Function: int mpfr_add_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2, 1504 mpfr_rnd_t RND) 1505 Set ROP to OP1 + OP2 rounded in the direction RND. The IEEE 754 1506 rules are used, in particular for signed zeros. But for types 1507 having no signed zeros, 0 is considered unsigned (i.e., 1508 (+0) + 0 = (+0) and (���0) + 0 = (���0)). The ���mpfr_add_d��� function 1509 assumes that the radix of the ���double��� type is a power of 2, with a 1510 precision at most that declared by the C implementation (macro 1511 ���IEEE_DBL_MANT_DIG���, and if not defined 53 bits). 1512 1513 -- Function: int mpfr_sub (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, 1514 mpfr_rnd_t RND) 1515 -- Function: int mpfr_ui_sub (mpfr_t ROP, unsigned long int OP1, mpfr_t 1516 OP2, mpfr_rnd_t RND) 1517 -- Function: int mpfr_sub_ui (mpfr_t ROP, mpfr_t OP1, unsigned long int 1518 OP2, mpfr_rnd_t RND) 1519 -- Function: int mpfr_si_sub (mpfr_t ROP, long int OP1, mpfr_t OP2, 1520 mpfr_rnd_t RND) 1521 -- Function: int mpfr_sub_si (mpfr_t ROP, mpfr_t OP1, long int OP2, 1522 mpfr_rnd_t RND) 1523 -- Function: int mpfr_d_sub (mpfr_t ROP, double OP1, mpfr_t OP2, 1524 mpfr_rnd_t RND) 1525 -- Function: int mpfr_sub_d (mpfr_t ROP, mpfr_t OP1, double OP2, 1526 mpfr_rnd_t RND) 1527 -- Function: int mpfr_z_sub (mpfr_t ROP, mpz_t OP1, mpfr_t OP2, 1528 mpfr_rnd_t RND) 1529 -- Function: int mpfr_sub_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2, 1530 mpfr_rnd_t RND) 1531 -- Function: int mpfr_sub_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2, 1532 mpfr_rnd_t RND) 1533 Set ROP to OP1 ��� OP2 rounded in the direction RND. The IEEE 754 1534 rules are used, in particular for signed zeros. But for types 1535 having no signed zeros, 0 is considered unsigned (i.e., 1536 (+0) ��� 0 = (+0), (���0) ��� 0 = (���0), 0 ��� (+0) = (���0) and 1537 0 ��� (���0) = (+0)). The same restrictions as for ���mpfr_add_d��� apply 1538 to ���mpfr_d_sub��� and ���mpfr_sub_d���. 1539 1540 -- Function: int mpfr_mul (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, 1541 mpfr_rnd_t RND) 1542 -- Function: int mpfr_mul_ui (mpfr_t ROP, mpfr_t OP1, unsigned long int 1543 OP2, mpfr_rnd_t RND) 1544 -- Function: int mpfr_mul_si (mpfr_t ROP, mpfr_t OP1, long int OP2, 1545 mpfr_rnd_t RND) 1546 -- Function: int mpfr_mul_d (mpfr_t ROP, mpfr_t OP1, double OP2, 1547 mpfr_rnd_t RND) 1548 -- Function: int mpfr_mul_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2, 1549 mpfr_rnd_t RND) 1550 -- Function: int mpfr_mul_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2, 1551 mpfr_rnd_t RND) 1552 Set ROP to OP1 times OP2 rounded in the direction RND. When a 1553 result is zero, its sign is the product of the signs of the 1554 operands (for types having no signed zeros, 0 is considered 1555 positive). The same restrictions as for ���mpfr_add_d��� apply to 1556 ���mpfr_mul_d���. Note: when OP1 and OP2 are equal, use ���mpfr_sqr��� 1557 instead of ���mpfr_mul��� for better efficiency. 1558 1559 -- Function: int mpfr_sqr (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1560 Set ROP to the square of OP rounded in the direction RND. 1561 1562 -- Function: int mpfr_div (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, 1563 mpfr_rnd_t RND) 1564 -- Function: int mpfr_ui_div (mpfr_t ROP, unsigned long int OP1, mpfr_t 1565 OP2, mpfr_rnd_t RND) 1566 -- Function: int mpfr_div_ui (mpfr_t ROP, mpfr_t OP1, unsigned long int 1567 OP2, mpfr_rnd_t RND) 1568 -- Function: int mpfr_si_div (mpfr_t ROP, long int OP1, mpfr_t OP2, 1569 mpfr_rnd_t RND) 1570 -- Function: int mpfr_div_si (mpfr_t ROP, mpfr_t OP1, long int OP2, 1571 mpfr_rnd_t RND) 1572 -- Function: int mpfr_d_div (mpfr_t ROP, double OP1, mpfr_t OP2, 1573 mpfr_rnd_t RND) 1574 -- Function: int mpfr_div_d (mpfr_t ROP, mpfr_t OP1, double OP2, 1575 mpfr_rnd_t RND) 1576 -- Function: int mpfr_div_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2, 1577 mpfr_rnd_t RND) 1578 -- Function: int mpfr_div_q (mpfr_t ROP, mpfr_t OP1, mpq_t OP2, 1579 mpfr_rnd_t RND) 1580 Set ROP to OP1 / OP2 rounded in the direction RND. When a result 1581 is zero, its sign is the product of the signs of the operands. For 1582 types having no signed zeros, 0 is considered positive; but note 1583 that if OP1 is non-zero and OP2 is zero, the result might change 1584 from ��Inf to NaN in future MPFR versions if there is an opposite 1585 decision on the IEEE 754 side. The same restrictions as for 1586 ���mpfr_add_d��� apply to ���mpfr_d_div��� and ���mpfr_div_d���. 1587 1588 -- Function: int mpfr_sqrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1589 -- Function: int mpfr_sqrt_ui (mpfr_t ROP, unsigned long int OP, 1590 mpfr_rnd_t RND) 1591 Set ROP to the square root of OP rounded in the direction RND. Set 1592 ROP to ���0 if OP is ���0, to be consistent with the IEEE 754 standard 1593 (thus this differs from ���mpfr_rootn_ui��� and ���mpfr_rootn_si��� with 1594 N = 2). Set ROP to NaN if OP is negative. 1595 1596 -- Function: int mpfr_rec_sqrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1597 Set ROP to the reciprocal square root of OP rounded in the 1598 direction RND. Set ROP to +Inf if OP is ��0, +0 if OP is +Inf, and 1599 NaN if OP is negative. Warning! Therefore the result on ���0 is 1600 different from the one of the rSqrt function recommended by the 1601 IEEE 754 standard (Section 9.2.1), which is ���Inf instead of +Inf. 1602 However, ���mpfr_rec_sqrt��� is equivalent to ���mpfr_rootn_si��� with 1603 N = ���2. 1604 1605 -- Function: int mpfr_cbrt (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1606 -- Function: int mpfr_rootn_ui (mpfr_t ROP, mpfr_t OP, unsigned long 1607 int N, mpfr_rnd_t RND) 1608 -- Function: int mpfr_rootn_si (mpfr_t ROP, mpfr_t OP, long int N, 1609 mpfr_rnd_t RND) 1610 Set ROP to the Nth root (with N = 3, the cubic root, for 1611 ���mpfr_cbrt���) of OP rounded in the direction RND. For N = 0, set 1612 ROP to NaN. For N odd (resp. even) and OP negative (including 1613 ���Inf), set ROP to a negative number (resp. NaN). If OP is zero, 1614 set ROP to zero with the sign obtained by the usual limit rules, 1615 i.e., the same sign as OP if N is odd, and positive if N is even. 1616 1617 These functions agree with the rootn operation of the IEEE 754 1618 standard. 1619 1620 -- Function: int mpfr_root (mpfr_t ROP, mpfr_t OP, unsigned long int N, 1621 mpfr_rnd_t RND) 1622 This function is the same as ���mpfr_rootn_ui��� except when OP is ���0 1623 and N is even: the result is ���0 instead of +0 (the reason was to be 1624 consistent with ���mpfr_sqrt���). Said otherwise, if OP is zero, set 1625 ROP to OP. 1626 1627 This function predates IEEE 754-2008, where rootn was introduced, 1628 and behaves differently from the IEEE 754 rootn operation. It is 1629 marked as deprecated and will be removed in a future release. 1630 1631 -- Function: int mpfr_neg (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1632 -- Function: int mpfr_abs (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1633 Set ROP to ���OP and the absolute value of OP respectively, rounded 1634 in the direction RND. Just changes or adjusts the sign if ROP and 1635 OP are the same variable, otherwise a rounding might occur if the 1636 precision of ROP is less than that of OP. 1637 1638 The sign rule also applies to NaN in order to mimic the IEEE 754 1639 ���negate��� and ���abs��� operations, i.e., for ���mpfr_neg���, the sign is 1640 reversed, and for ���mpfr_abs���, the sign is set to positive. But 1641 contrary to IEEE 754, the NaN flag is set as usual. 1642 1643 -- Function: int mpfr_dim (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, 1644 mpfr_rnd_t RND) 1645 Set ROP to the positive difference of OP1 and OP2, i.e., OP1 ��� OP2 1646 rounded in the direction RND if OP1 > OP2, +0 if OP1 <= OP2, and 1647 NaN if OP1 or OP2 is NaN. 1648 1649 -- Function: int mpfr_mul_2ui (mpfr_t ROP, mpfr_t OP1, unsigned long 1650 int OP2, mpfr_rnd_t RND) 1651 -- Function: int mpfr_mul_2si (mpfr_t ROP, mpfr_t OP1, long int OP2, 1652 mpfr_rnd_t RND) 1653 Set ROP to OP1 times 2 raised to OP2 rounded in the direction RND. 1654 Just increases the exponent by OP2 when ROP and OP1 are identical. 1655 1656 -- Function: int mpfr_div_2ui (mpfr_t ROP, mpfr_t OP1, unsigned long 1657 int OP2, mpfr_rnd_t RND) 1658 -- Function: int mpfr_div_2si (mpfr_t ROP, mpfr_t OP1, long int OP2, 1659 mpfr_rnd_t RND) 1660 Set ROP to OP1 divided by 2 raised to OP2 rounded in the direction 1661 RND. Just decreases the exponent by OP2 when ROP and OP1 are 1662 identical. 1663 1664 -- Function: int mpfr_fac_ui (mpfr_t ROP, unsigned long int OP, 1665 mpfr_rnd_t RND) 1666 Set ROP to the factorial of OP, rounded in the direction RND. 1667 1668 -- Function: int mpfr_fma (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_t 1669 OP3, mpfr_rnd_t RND) 1670 -- Function: int mpfr_fms (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_t 1671 OP3, mpfr_rnd_t RND) 1672 Set ROP to (OP1 times OP2) + OP3 (resp. (OP1 times OP2) ��� OP3) 1673 rounded in the direction RND. Concerning special values (signed 1674 zeros, infinities, NaN), these functions behave like a 1675 multiplication followed by a separate addition or subtraction. 1676 That is, the fused operation matters only for rounding. 1677 1678 -- Function: int mpfr_fmma (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_t 1679 OP3, mpfr_t OP4, mpfr_rnd_t RND) 1680 -- Function: int mpfr_fmms (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, mpfr_t 1681 OP3, mpfr_t OP4, mpfr_rnd_t RND) 1682 Set ROP to (OP1 times OP2) + (OP3 times OP4) (resp. 1683 (OP1 times OP2) ��� (OP3 times OP4)) rounded in the direction RND. 1684 In case the computation of OP1 times OP2 overflows or underflows 1685 (or that of OP3 times OP4), the result ROP is computed as if the 1686 two intermediate products were computed with rounding toward zero. 1687 1688 -- Function: int mpfr_hypot (mpfr_t ROP, mpfr_t X, mpfr_t Y, mpfr_rnd_t 1689 RND) 1690 Set ROP to the Euclidean norm of X and Y, i.e., the square root of 1691 the sum of the squares of X and Y, rounded in the direction RND. 1692 Special values are handled as described in the ISO C99 1693 (Section F.9.4.3) and IEEE 754 (Section 9.2.1) standards: If X or Y 1694 is an infinity, then +Inf is returned in ROP, even if the other 1695 number is NaN. 1696 1697 -- Function: int mpfr_sum (mpfr_t ROP, const mpfr_ptr TAB[], unsigned 1698 long int N, mpfr_rnd_t RND) 1699 Set ROP to the sum of all elements of TAB, whose size is N, 1700 correctly rounded in the direction RND. Warning: for efficiency 1701 reasons, TAB is an array of pointers to ���mpfr_t���, not an array of 1702 ���mpfr_t���. If N = 0, then the result is +0, and if N = 1, then the 1703 function is equivalent to ���mpfr_set���. For the special exact cases, 1704 the result is the same as the one obtained with a succession of 1705 additions (���mpfr_add���) in infinite precision. In particular, if 1706 the result is an exact zero and N >= 1: 1707 ��� if all the inputs have the same sign (i.e., all +0 or all ���0), 1708 then the result has the same sign as the inputs; 1709 ��� otherwise, either because all inputs are zeros with at least a 1710 +0 and a ���0, or because some inputs are non-zero (but they 1711 globally cancel), the result is +0, except for the ���MPFR_RNDD��� 1712 rounding mode, where it is ���0. 1713 1714 -- Function: int mpfr_dot (mpfr_t ROP, const mpfr_ptr A[], const 1715 mpfr_ptr B[], unsigned long int N, mpfr_rnd_t RND) 1716 Set ROP to the dot product of elements of A by those of B, whose 1717 common size is N, correctly rounded in the direction RND. Warning: 1718 for efficiency reasons, A and B are arrays of pointers to ���mpfr_t���. 1719 This function is experimental, and does not yet handle intermediate 1720 overflows and underflows. 1721 1722 For the power functions (with an integer exponent or not), see *note 1723mpfr_pow:: in *note Transcendental Functions::. 1724 1725 1726File: mpfr.info, Node: Comparison Functions, Next: Transcendental Functions, Prev: Arithmetic Functions, Up: MPFR Interface 1727 17285.6 Comparison Functions 1729======================== 1730 1731 -- Function: int mpfr_cmp (mpfr_t OP1, mpfr_t OP2) 1732 -- Function: int mpfr_cmp_ui (mpfr_t OP1, unsigned long int OP2) 1733 -- Function: int mpfr_cmp_si (mpfr_t OP1, long int OP2) 1734 -- Function: int mpfr_cmp_d (mpfr_t OP1, double OP2) 1735 -- Function: int mpfr_cmp_ld (mpfr_t OP1, long double OP2) 1736 -- Function: int mpfr_cmp_z (mpfr_t OP1, mpz_t OP2) 1737 -- Function: int mpfr_cmp_q (mpfr_t OP1, mpq_t OP2) 1738 -- Function: int mpfr_cmp_f (mpfr_t OP1, mpf_t OP2) 1739 Compare OP1 and OP2. Return a positive value if OP1 > OP2, zero if 1740 OP1 = OP2, and a negative value if OP1 < OP2. Both OP1 and OP2 are 1741 considered to their full own precision, which may differ. If one 1742 of the operands is NaN, set the _erange_ flag and return zero. 1743 1744 Note: These functions may be useful to distinguish the three 1745 possible cases. If you need to distinguish two cases only, it is 1746 recommended to use the predicate functions (e.g., ���mpfr_equal_p��� 1747 for the equality) described below; they behave like the IEEE 754 1748 comparisons, in particular when one or both arguments are NaN. But 1749 only floating-point numbers can be compared (you may need to do a 1750 conversion first). 1751 1752 -- Function: int mpfr_cmp_ui_2exp (mpfr_t OP1, unsigned long int OP2, 1753 mpfr_exp_t E) 1754 -- Function: int mpfr_cmp_si_2exp (mpfr_t OP1, long int OP2, mpfr_exp_t 1755 E) 1756 Compare OP1 and OP2 multiplied by two to the power E. Similar as 1757 above. 1758 1759 -- Function: int mpfr_cmpabs (mpfr_t OP1, mpfr_t OP2) 1760 -- Function: int mpfr_cmpabs_ui (mpfr_t OP1, unsigned long int OP2) 1761 Compare |OP1| and |OP2|. Return a positive value if |OP1| > |OP2|, 1762 zero if |OP1| = |OP2|, and a negative value if |OP1| < |OP2|. If 1763 one of the operands is NaN, set the _erange_ flag and return zero. 1764 1765 -- Function: int mpfr_nan_p (mpfr_t OP) 1766 -- Function: int mpfr_inf_p (mpfr_t OP) 1767 -- Function: int mpfr_number_p (mpfr_t OP) 1768 -- Function: int mpfr_zero_p (mpfr_t OP) 1769 -- Function: int mpfr_regular_p (mpfr_t OP) 1770 Return non-zero if OP is respectively NaN, an infinity, an ordinary 1771 number (i.e., neither NaN nor an infinity), zero, or a regular 1772 number (i.e., neither NaN, nor an infinity nor zero). Return zero 1773 otherwise. 1774 1775 -- Macro: int mpfr_sgn (mpfr_t OP) 1776 Return a positive value if OP > 0, zero if OP = 0, and a negative 1777 value if OP < 0. If the operand is NaN, set the _erange_ flag and 1778 return zero. This is equivalent to ���mpfr_cmp_ui (OP, 0)���, but more 1779 efficient. 1780 1781 -- Function: int mpfr_greater_p (mpfr_t OP1, mpfr_t OP2) 1782 -- Function: int mpfr_greaterequal_p (mpfr_t OP1, mpfr_t OP2) 1783 -- Function: int mpfr_less_p (mpfr_t OP1, mpfr_t OP2) 1784 -- Function: int mpfr_lessequal_p (mpfr_t OP1, mpfr_t OP2) 1785 -- Function: int mpfr_equal_p (mpfr_t OP1, mpfr_t OP2) 1786 Return non-zero if OP1 > OP2, OP1 >= OP2, OP1 < OP2, OP1 <= OP2, 1787 OP1 = OP2 respectively, and zero otherwise. Those functions return 1788 zero whenever OP1 and/or OP2 is NaN. 1789 1790 -- Function: int mpfr_lessgreater_p (mpfr_t OP1, mpfr_t OP2) 1791 Return non-zero if OP1 < OP2 or OP1 > OP2 (i.e., neither OP1, nor 1792 OP2 is NaN, and OP1 <> OP2), zero otherwise (i.e., OP1 and/or OP2 1793 is NaN, or OP1 = OP2). 1794 1795 -- Function: int mpfr_unordered_p (mpfr_t OP1, mpfr_t OP2) 1796 Return non-zero if OP1 or OP2 is a NaN (i.e., they cannot be 1797 compared), zero otherwise. 1798 1799 -- Function: int mpfr_total_order_p (mpfr_t X, mpfr_t Y) 1800 This function implements the totalOrder predicate from IEEE 754, 1801 where ���NaN < ���Inf < negative finite numbers < ���0 < +0 < positive 1802 finite numbers < +Inf < +NaN. It returns a non-zero value (true) 1803 when X is smaller than or equal to Y for this order relation, and 1804 zero (false) otherwise. Contrary to ���mpfr_cmp (X, Y)���, which 1805 returns a ternary value, ���mpfr_total_order_p��� returns a binary 1806 value (zero or non-zero). In particular, ���mpfr_total_order_p (X, 1807 X)��� returns true, ���mpfr_total_order_p (-0, +0)��� returns true and 1808 ���mpfr_total_order_p (+0, -0)��� returns false. The sign bit of NaN 1809 also matters. 1810 1811 1812File: mpfr.info, Node: Transcendental Functions, Next: Input and Output Functions, Prev: Comparison Functions, Up: MPFR Interface 1813 18145.7 Transcendental Functions 1815============================ 1816 1817All those functions, except explicitly stated (for example 1818���mpfr_sin_cos���), return a *note ternary value::, i.e., zero for an exact 1819return value, a positive value for a return value larger than the exact 1820result, and a negative value otherwise. 1821 1822 Important note: In some domains, computing transcendental functions 1823(even more with correct rounding) is expensive, even in small precision, 1824for example the trigonometric and Bessel functions with a large 1825argument. For some functions, the algorithm complexity and memory usage 1826does not depend only on the output precision: for instance, the memory 1827usage of ���mpfr_rootn_ui��� is also linear in the argument K, and the 1828memory usage of the incomplete Gamma function also depends on the 1829precision of the input OP. It is also theoretically possible that some 1830functions on some particular inputs might be very hard to round (i.e. 1831the Table Maker���s Dilemma occurs in much larger precisions than normally 1832expected from the context), meaning that the internal precision needs to 1833be increased even more; but it is conjectured that the needed precision 1834has a reasonable bound (and in particular, that potentially exact cases 1835are known and can be detected efficiently). 1836 1837 -- Function: int mpfr_log (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1838 -- Function: int mpfr_log_ui (mpfr_t ROP, unsigned long int OP, 1839 mpfr_rnd_t RND) 1840 -- Function: int mpfr_log2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1841 -- Function: int mpfr_log10 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1842 Set ROP to the natural logarithm of OP, log2(OP) or log10(OP), 1843 respectively, rounded in the direction RND. Set ROP to +0 if OP is 1844 1 (in all rounding modes), for consistency with the ISO C99 and 1845 IEEE 754 standards. Set ROP to ���Inf if OP is ��0 (i.e., the sign of 1846 the zero has no influence on the result). 1847 1848 -- Function: int mpfr_log1p (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1849 -- Function: int mpfr_log2p1 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1850 -- Function: int mpfr_log10p1 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1851 Set ROP to the logarithm of one plus OP (in radix two for 1852 ���mpfr_log2p1���, and in radix ten for ���mpfr_log10p1���), rounded in the 1853 direction RND. Set ROP to ���Inf if OP is ���1. 1854 1855 -- Function: int mpfr_exp (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1856 -- Function: int mpfr_exp2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1857 -- Function: int mpfr_exp10 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1858 Set ROP to the exponential of OP, to 2 power of OP or to 10 power 1859 of OP, respectively, rounded in the direction RND. 1860 1861 -- Function: int mpfr_expm1 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1862 -- Function: int mpfr_exp2m1 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1863 -- Function: int mpfr_exp10m1 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1864 Set ROP to the exponential of OP followed by a subtraction by one 1865 (resp. 2 power of OP followed by a subtraction by one, and 10 power 1866 of OP followed by a subtraction by one), rounded in the direction 1867 RND. 1868 1869 -- Function: int mpfr_pow (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, 1870 mpfr_rnd_t RND) 1871 -- Function: int mpfr_powr (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, 1872 mpfr_rnd_t RND) 1873 -- Function: int mpfr_pow_ui (mpfr_t ROP, mpfr_t OP1, unsigned long int 1874 OP2, mpfr_rnd_t RND) 1875 -- Function: int mpfr_pow_si (mpfr_t ROP, mpfr_t OP1, long int OP2, 1876 mpfr_rnd_t RND) 1877 -- Function: int mpfr_pow_uj (mpfr_t ROP, mpfr_t OP1, uintmax_t OP2, 1878 mpfr_rnd_t RND) 1879 -- Function: int mpfr_pow_sj (mpfr_t ROP, mpfr_t OP1, intmax_t OP2, 1880 mpfr_rnd_t RND) 1881 -- Function: int mpfr_pown (mpfr_t ROP, mpfr_t OP1, intmax_t OP2, 1882 mpfr_rnd_t RND) 1883 -- Function: int mpfr_pow_z (mpfr_t ROP, mpfr_t OP1, mpz_t OP2, 1884 mpfr_rnd_t RND) 1885 -- Function: int mpfr_ui_pow_ui (mpfr_t ROP, unsigned long int OP1, 1886 unsigned long int OP2, mpfr_rnd_t RND) 1887 -- Function: int mpfr_ui_pow (mpfr_t ROP, unsigned long int OP1, mpfr_t 1888 OP2, mpfr_rnd_t RND) 1889 Set ROP to OP1 raised to OP2, rounded in the direction RND. The 1890 ���mpfr_powr��� function corresponds to the ���powr��� function from 1891 IEEE 754, i.e., it computes the exponential of OP2 multiplied by 1892 the logarithm of OP1. The ���mpfr_pown��� function is just an alias 1893 for ���mpfr_pow_sj��� (defined with ���#define mpfr_pown mpfr_pow_sj���), 1894 to follow the C2x function ���pown���. Special values are handled as 1895 described in the ISO C99 and IEEE 754 standards for the ���pow��� 1896 function: 1897 ��� ���pow(��0, Y)��� returns ��Inf for Y a negative odd integer. 1898 ��� ���pow(��0, Y)��� returns +Inf for Y negative and not an odd 1899 integer. 1900 ��� ���pow(��0, Y)��� returns ��0 for Y a positive odd integer. 1901 ��� ���pow(��0, Y)��� returns +0 for Y positive and not an odd integer. 1902 ��� ���pow(-1, ��Inf)��� returns 1. 1903 ��� ���pow(+1, Y)��� returns 1 for any Y, even a NaN. 1904 ��� ���pow(X, ��0)��� returns 1 for any X, even a NaN. 1905 ��� ���pow(X, Y)��� returns NaN for finite negative X and finite 1906 non-integer Y. 1907 ��� ���pow(X, -Inf)��� returns +Inf for 0 < abs(x) < 1, and +0 for 1908 abs(x) > 1. 1909 ��� ���pow(X, +Inf)��� returns +0 for 0 < abs(x) < 1, and +Inf for 1910 abs(x) > 1. 1911 ��� ���pow(-Inf, Y)��� returns ���0 for Y a negative odd integer. 1912 ��� ���pow(-Inf, Y)��� returns +0 for Y negative and not an odd 1913 integer. 1914 ��� ���pow(-Inf, Y)��� returns ���Inf for Y a positive odd integer. 1915 ��� ���pow(-Inf, Y)��� returns +Inf for Y positive and not an odd 1916 integer. 1917 ��� ���pow(+Inf, Y)��� returns +0 for Y negative, and +Inf for Y 1918 positive. 1919 Note: When 0 is of integer type, it is regarded as +0 by these 1920 functions. We do not use the usual limit rules in this case, as 1921 these rules are not used for ���pow���. 1922 1923 -- Function: int mpfr_compound_si (mpfr_t ROP, mpfr_t OP, long int N, 1924 mpfr_rnd_t RND) 1925 Set ROP to the power N of one plus OP, following IEEE 754 for the 1926 special cases and exceptions. In particular: 1927 ��� When OP < ���1, ROP is set to NaN. 1928 ��� When N is zero and OP is NaN (like any value greater or equal 1929 to ���1), ROP is set to 1. 1930 ��� When OP = ���1, ROP is set to +Inf for N < 0, and to +0 for 1931 N > 0. 1932 The other special cases follow the usual rules. 1933 1934 -- Function: int mpfr_cos (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1935 -- Function: int mpfr_sin (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1936 -- Function: int mpfr_tan (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1937 Set ROP to the cosine of OP, sine of OP, tangent of OP, rounded in 1938 the direction RND. 1939 1940 -- Function: int mpfr_cosu (mpfr_t ROP, mpfr_t OP, unsigned long int U, 1941 mpfr_rnd_t RND) 1942 -- Function: int mpfr_sinu (mpfr_t ROP, mpfr_t OP, unsigned long int U, 1943 mpfr_rnd_t RND) 1944 -- Function: int mpfr_tanu (mpfr_t ROP, mpfr_t OP, unsigned long int U, 1945 mpfr_rnd_t RND) 1946 Set ROP to the cosine (resp. sine and tangent) of OP multiplied by 1947 2 Pi and divided by U. For example, if U equals 360, one gets the 1948 cosine (resp. sine and tangent) for OP in degrees. For 1949 ���mpfr_cosu���, when OP multiplied by 2 and divided by U is a 1950 half-integer, the result is +0, following IEEE 754 (cosPi), so that 1951 the function is even. For ���mpfr_sinu���, when OP multiplied by 2 and 1952 divided by U is an integer, the result is zero with the same sign 1953 as OP, following IEEE 754 (sinPi), so that the function is odd. 1954 Similarly, the function ���mpfr_tanu��� follows IEEE 754 (tanPi). 1955 1956 -- Function: int mpfr_cospi (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1957 -- Function: int mpfr_sinpi (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1958 -- Function: int mpfr_tanpi (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1959 Set ROP to the cosine (resp. sine and tangent) of OP multiplied by 1960 Pi. See the description of ���mpfr_sinu���, ���mpfr_cosu��� and 1961 ���mpfr_tanu��� for special values. 1962 1963 -- Function: int mpfr_sin_cos (mpfr_t SOP, mpfr_t COP, mpfr_t OP, 1964 mpfr_rnd_t RND) 1965 Set simultaneously SOP to the sine of OP and COP to the cosine of 1966 OP, rounded in the direction RND with the corresponding precisions 1967 of SOP and COP, which must be different variables. Return 0 iff 1968 both results are exact, more precisely it returns s + 4c where 1969 s = 0 if SOP is exact, s = 1 if SOP is larger than the sine of OP, 1970 s = 2 if SOP is smaller than the sine of OP, and similarly for c 1971 and the cosine of OP. 1972 1973 -- Function: int mpfr_sec (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1974 -- Function: int mpfr_csc (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1975 -- Function: int mpfr_cot (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1976 Set ROP to the secant of OP, cosecant of OP, cotangent of OP, 1977 rounded in the direction RND. 1978 1979 -- Function: int mpfr_acos (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1980 -- Function: int mpfr_asin (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1981 -- Function: int mpfr_atan (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 1982 Set ROP to the arc-cosine, arc-sine or arc-tangent of OP, rounded 1983 in the direction RND. Note that since ���acos(-1)��� returns the 1984 floating-point number closest to Pi according to the given rounding 1985 mode, this number might not be in the output range 0 <= ROP < Pi of 1986 the arc-cosine function; still, the result lies in the image of the 1987 output range by the rounding function. The same holds for 1988 ���asin(-1)���, ���asin(1)���, ���atan(-Inf)���, ���atan(+Inf)��� or for ���atan(OP)��� 1989 with large OP and small precision of ROP. 1990 1991 -- Function: int mpfr_acosu (mpfr_t ROP, mpfr_t OP, unsigned long int 1992 U, mpfr_rnd_t RND) 1993 -- Function: int mpfr_asinu (mpfr_t ROP, mpfr_t OP, unsigned long int 1994 U, mpfr_rnd_t RND) 1995 -- Function: int mpfr_atanu (mpfr_t ROP, mpfr_t OP, unsigned long int 1996 U, mpfr_rnd_t RND) 1997 Set ROP to A multiplied by U and divided by 2 Pi, where A is the 1998 arc-cosine (resp. arc-sine and arc-tangent) of OP. For example, if 1999 U equals 360, ���mpfr_acosu��� yields the arc-cosine in degrees. 2000 2001 -- Function: int mpfr_acospi (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2002 -- Function: int mpfr_asinpi (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2003 -- Function: int mpfr_atanpi (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2004 Set ROP to ���acos(OP)��� (resp. ���asin(OP)��� and ���atan(OP)���) divided by 2005 Pi. 2006 2007 -- Function: int mpfr_atan2 (mpfr_t ROP, mpfr_t Y, mpfr_t X, mpfr_rnd_t 2008 RND) 2009 -- Function: int mpfr_atan2u (mpfr_t ROP, mpfr_t Y, mpfr_t X, unsigned 2010 long int U, mpfr_rnd_t RND) 2011 -- Function: int mpfr_atan2pi (mpfr_t ROP, mpfr_t Y, mpfr_t X, 2012 mpfr_rnd_t RND) 2013 For ���mpfr_atan2���, set ROP to the arc-tangent2 of Y and X, rounded 2014 in the direction RND: if X > 0, then ���atan2(Y, X)��� returns 2015 atan(Y/X); if X < 0, then ���atan2(Y, X)��� returns the sign of Y 2016 multiplied by Pi ��� atan(abs(Y/X)), thus a number from ���Pi to Pi. 2017 As for ���atan���, in case the exact mathematical result is +Pi or ���Pi, 2018 its rounded result might be outside the function output range. The 2019 function ���mpfr_atan2u��� behaves similarly, except the result is 2020 multiplied by U and divided by 2 Pi; and ���mpfr_atan2pi��� is the same 2021 as ���mpfr_atan2u��� with U = 2. For example, if U equals 360, 2022 ���mpfr_atan2u��� returns the arc-tangent in degrees, with values from 2023 ���180 to 180. 2024 2025 ���atan2(Y, 0)��� does not raise any floating-point exception. Special 2026 values are handled as described in the ISO C99 and IEEE 754 2027 standards for the ���atan2��� function: 2028 ��� ���atan2(+0, -0)��� returns +Pi. 2029 ��� ���atan2(-0, -0)��� returns ���Pi. 2030 ��� ���atan2(+0, +0)��� returns +0. 2031 ��� ���atan2(-0, +0)��� returns ���0. 2032 ��� ���atan2(+0, X)��� returns +Pi for X < 0. 2033 ��� ���atan2(-0, X)��� returns ���Pi for X < 0. 2034 ��� ���atan2(+0, X)��� returns +0 for X > 0. 2035 ��� ���atan2(-0, X)��� returns ���0 for X > 0. 2036 ��� ���atan2(Y, 0)��� returns ���Pi/2 for Y < 0. 2037 ��� ���atan2(Y, 0)��� returns +Pi/2 for Y > 0. 2038 ��� ���atan2(+Inf, -Inf)��� returns +3*Pi/4. 2039 ��� ���atan2(-Inf, -Inf)��� returns ���3*Pi/4. 2040 ��� ���atan2(+Inf, +Inf)��� returns +Pi/4. 2041 ��� ���atan2(-Inf, +Inf)��� returns ���Pi/4. 2042 ��� ���atan2(+Inf, X)��� returns +Pi/2 for finite X. 2043 ��� ���atan2(-Inf, X)��� returns ���Pi/2 for finite X. 2044 ��� ���atan2(Y, -Inf)��� returns +Pi for finite Y > 0. 2045 ��� ���atan2(Y, -Inf)��� returns ���Pi for finite Y < 0. 2046 ��� ���atan2(Y, +Inf)��� returns +0 for finite Y > 0. 2047 ��� ���atan2(Y, +Inf)��� returns ���0 for finite Y < 0. 2048 2049 -- Function: int mpfr_cosh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2050 -- Function: int mpfr_sinh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2051 -- Function: int mpfr_tanh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2052 Set ROP to the hyperbolic cosine, sine or tangent of OP, rounded in 2053 the direction RND. 2054 2055 -- Function: int mpfr_sinh_cosh (mpfr_t SOP, mpfr_t COP, mpfr_t OP, 2056 mpfr_rnd_t RND) 2057 Set simultaneously SOP to the hyperbolic sine of OP and COP to the 2058 hyperbolic cosine of OP, rounded in the direction RND with the 2059 corresponding precision of SOP and COP, which must be different 2060 variables. Return 0 iff both results are exact (see ���mpfr_sin_cos��� 2061 for a more detailed description of the return value). 2062 2063 -- Function: int mpfr_sech (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2064 -- Function: int mpfr_csch (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2065 -- Function: int mpfr_coth (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2066 Set ROP to the hyperbolic secant of OP, cosecant of OP, cotangent 2067 of OP, rounded in the direction RND. 2068 2069 -- Function: int mpfr_acosh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2070 -- Function: int mpfr_asinh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2071 -- Function: int mpfr_atanh (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2072 Set ROP to the inverse hyperbolic cosine, sine or tangent of OP, 2073 rounded in the direction RND. 2074 2075 -- Function: int mpfr_eint (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2076 Set ROP to the exponential integral of OP, rounded in the direction 2077 RND. This is the sum of Euler���s constant, of the logarithm of the 2078 absolute value of OP, and of the sum for k from 1 to infinity of OP 2079 to the power k, divided by k and the factorial of k. For positive 2080 OP, it corresponds to the Ei function at OP (see formula 5.1.10 2081 from the Handbook of Mathematical Functions from Abramowitz and 2082 Stegun), and for negative OP, to the opposite of the E1 function 2083 (sometimes called eint1) at ���OP (formula 5.1.1 from the same 2084 reference). 2085 2086 -- Function: int mpfr_li2 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2087 Set ROP to real part of the dilogarithm of OP, rounded in the 2088 direction RND. MPFR defines the dilogarithm function as the 2089 integral of ���log(1���t)/t from 0 to OP. 2090 2091 -- Function: int mpfr_gamma (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2092 -- Function: int mpfr_gamma_inc (mpfr_t ROP, mpfr_t OP, mpfr_t OP2, 2093 mpfr_rnd_t RND) 2094 Set ROP to the value of the Gamma function on OP, resp. the 2095 incomplete Gamma function on OP and OP2, rounded in the direction 2096 RND. (In the literature, ���mpfr_gamma_inc��� is called upper 2097 incomplete Gamma function, or sometimes complementary incomplete 2098 Gamma function.) For ���mpfr_gamma��� (and ���mpfr_gamma_inc��� when OP2 2099 is zero), when OP is a negative integer, ROP is set to NaN. 2100 2101 Note: the current implementation of ���mpfr_gamma_inc��� is slow for 2102 large values of ROP or OP, in which case some internal overflow 2103 might also occur. 2104 2105 -- Function: int mpfr_lngamma (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2106 Set ROP to the value of the logarithm of the Gamma function on OP, 2107 rounded in the direction RND. When OP is 1 or 2, set ROP to +0 (in 2108 all rounding modes). When OP is an infinity or a non-positive 2109 integer, set ROP to +Inf, following the general rules on special 2110 values. When ���2k ��� 1 < OP < ���2k, k being a non-negative integer, 2111 set ROP to NaN. See also ���mpfr_lgamma���. 2112 2113 -- Function: int mpfr_lgamma (mpfr_t ROP, int *SIGNP, mpfr_t OP, 2114 mpfr_rnd_t RND) 2115 Set ROP to the value of the logarithm of the absolute value of the 2116 Gamma function on OP, rounded in the direction RND. The sign (1 or 2117 ���1) of Gamma(OP) is returned in the object pointed to by SIGNP. 2118 When OP is 1 or 2, set ROP to +0 (in all rounding modes). When OP 2119 is an infinity or a non-positive integer, set ROP to +Inf. When OP 2120 is NaN, ���Inf or a negative integer, *SIGNP is undefined, and when 2121 OP is ��0, *SIGNP is the sign of the zero. 2122 2123 -- Function: int mpfr_digamma (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2124 Set ROP to the value of the Digamma (sometimes also called Psi) 2125 function on OP, rounded in the direction RND. When OP is a 2126 negative integer, set ROP to NaN. 2127 2128 -- Function: int mpfr_beta (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, 2129 mpfr_rnd_t RND) 2130 Set ROP to the value of the Beta function at arguments OP1 and OP2. 2131 Note: the current code does not try to avoid internal overflow or 2132 underflow, and might use a huge internal precision in some cases. 2133 2134 -- Function: int mpfr_zeta (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2135 -- Function: int mpfr_zeta_ui (mpfr_t ROP, unsigned long int OP, 2136 mpfr_rnd_t RND) 2137 Set ROP to the value of the Riemann Zeta function on OP, rounded in 2138 the direction RND. 2139 2140 -- Function: int mpfr_erf (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2141 -- Function: int mpfr_erfc (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2142 Set ROP to the value of the error function on OP (resp. the 2143 complementary error function on OP) rounded in the direction RND. 2144 2145 -- Function: int mpfr_j0 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2146 -- Function: int mpfr_j1 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2147 -- Function: int mpfr_jn (mpfr_t ROP, long int N, mpfr_t OP, mpfr_rnd_t 2148 RND) 2149 Set ROP to the value of the first kind Bessel function of order 0, 2150 (resp. 1 and N) on OP, rounded in the direction RND. When OP is 2151 NaN, ROP is always set to NaN. When OP is positive or negative 2152 infinity, ROP is set to +0. When OP is zero, and N is not zero, 2153 ROP is set to +0 or ���0 depending on the parity and sign of N, and 2154 the sign of OP. 2155 2156 -- Function: int mpfr_y0 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2157 -- Function: int mpfr_y1 (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2158 -- Function: int mpfr_yn (mpfr_t ROP, long int N, mpfr_t OP, mpfr_rnd_t 2159 RND) 2160 Set ROP to the value of the second kind Bessel function of order 0 2161 (resp. 1 and N) on OP, rounded in the direction RND. When OP is 2162 NaN or negative, ROP is always set to NaN. When OP is +Inf, ROP is 2163 set to +0. When OP is zero, ROP is set to +Inf or ���Inf depending 2164 on the parity and sign of N. 2165 2166 -- Function: int mpfr_agm (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, 2167 mpfr_rnd_t RND) 2168 Set ROP to the arithmetic-geometric mean of OP1 and OP2, rounded in 2169 the direction RND. The arithmetic-geometric mean is the common 2170 limit of the sequences u_n and v_n, where u_0 = OP1, v_0 = OP2, 2171 u_(n+1) is the arithmetic mean of u_n and v_n, and v_(n+1) is the 2172 geometric mean of u_n and v_n. If any operand is negative and the 2173 other one is not zero, set ROP to NaN. If any operand is zero and 2174 the other one is finite (resp. infinite), set ROP to +0 (resp. 2175 NaN). 2176 2177 -- Function: int mpfr_ai (mpfr_t ROP, mpfr_t X, mpfr_rnd_t RND) 2178 Set ROP to the value of the Airy function Ai on X, rounded in the 2179 direction RND. When X is NaN, ROP is always set to NaN. When X is 2180 +Inf or ���Inf, ROP is +0. The current implementation is not 2181 intended to be used with large arguments. It works with abs(X) 2182 typically smaller than 500. For larger arguments, other methods 2183 should be used and will be implemented in a future version. 2184 2185 -- Function: int mpfr_const_log2 (mpfr_t ROP, mpfr_rnd_t RND) 2186 -- Function: int mpfr_const_pi (mpfr_t ROP, mpfr_rnd_t RND) 2187 -- Function: int mpfr_const_euler (mpfr_t ROP, mpfr_rnd_t RND) 2188 -- Function: int mpfr_const_catalan (mpfr_t ROP, mpfr_rnd_t RND) 2189 Set ROP to the logarithm of 2, the value of Pi, of Euler���s constant 2190 0.577..., of Catalan���s constant 0.915..., respectively, rounded in 2191 the direction RND. These functions cache the computed values to 2192 avoid other calculations if a lower or equal precision is 2193 requested. To free these caches, use ���mpfr_free_cache��� or 2194 ���mpfr_free_cache2���. 2195 2196 2197File: mpfr.info, Node: Input and Output Functions, Next: Formatted Output Functions, Prev: Transcendental Functions, Up: MPFR Interface 2198 21995.8 Input and Output Functions 2200============================== 2201 2202This section describes functions that perform input from an input/output 2203stream, and functions that output to an input/output stream. Passing a 2204null pointer for a ���stream��� to any of these functions will make them 2205read from ���stdin��� and write to ���stdout���, respectively. 2206 2207 When using a function that takes a ���FILE *��� argument, you must 2208include the ���<stdio.h>��� standard header before ���mpfr.h���, to allow 2209���mpfr.h��� to define prototypes for these functions. 2210 2211 -- Function: size_t mpfr_out_str (FILE *STREAM, int BASE, size_t N, 2212 mpfr_t OP, mpfr_rnd_t RND) 2213 Output OP on stream STREAM as a text string in base abs(BASE), 2214 rounded in the direction RND. The base may vary from 2 to 62 or 2215 from ���2 to ���36 (any other value yields undefined behavior). The 2216 argument N has the same meaning as in ���mpfr_get_str��� (*note 2217 mpfr_get_str::): Print N significant digits exactly, or if N is 0, 2218 the number ���mpfr_get_str_ndigits (BASE, P)���, where P is the 2219 precision of OP (*note mpfr_get_str_ndigits::). 2220 2221 If the input is NaN, +Inf, ���Inf, +0, or ���0, then ���@NaN@���, ���@Inf@���, 2222 ���-@Inf@���, ���0���, or ���-0��� is output, respectively. 2223 2224 For the regular numbers, the format of the output is the following: 2225 the most significant digit, then a decimal-point character (defined 2226 by the current locale), then the remaining N ��� 1 digits (including 2227 trailing zeros), then the exponent prefix, then the exponent in 2228 decimal. The exponent prefix is ���e��� when abs(BASE) <= 10, and ���@��� 2229 when abs(BASE) > 10. *Note mpfr_get_str:: for information on the 2230 digits depending on the base. 2231 2232 Return the number of characters written, or if an error occurred, 2233 return 0. 2234 2235 -- Function: size_t mpfr_inp_str (mpfr_t ROP, FILE *STREAM, int BASE, 2236 mpfr_rnd_t RND) 2237 Input a string in base BASE from stream STREAM, rounded in the 2238 direction RND, and put the read float in ROP. 2239 2240 After skipping optional whitespace (as defined by ���isspace���, which 2241 depends on the current locale), this function reads a word, defined 2242 as the longest sequence of non-whitespace characters, and parses it 2243 using ���mpfr_set_str���. See the documentation of ���mpfr_strtofr��� for 2244 a detailed description of the valid string formats. 2245 2246 Return the number of bytes read (including the leading whitespace, 2247 if any), or if the string format is invalid or an error occurred, 2248 return 0. 2249 2250 -- Function: int mpfr_fpif_export (FILE *STREAM, mpfr_t OP) 2251 Export the number OP to the stream STREAM in a floating-point 2252 interchange format. In particular one can export on a 32-bit 2253 computer and import on a 64-bit computer, or export on a 2254 little-endian computer and import on a big-endian computer. The 2255 precision of OP and the sign bit of a NaN are stored too. Return 0 2256 iff the export was successful. 2257 2258 Note: this function is experimental and its interface might change 2259 in future versions. 2260 2261 -- Function: int mpfr_fpif_import (mpfr_t OP, FILE *STREAM) 2262 Import the number OP from the stream STREAM in a floating-point 2263 interchange format (see ���mpfr_fpif_export���). Note that the 2264 precision of OP is set to the one read from the stream, and the 2265 sign bit is always retrieved (even for NaN). If the stored 2266 precision is zero or greater than ���MPFR_PREC_MAX���, the function 2267 fails (it returns non-zero) and OP is unchanged. If the function 2268 fails for another reason, OP is set to NaN and it is unspecified 2269 whether the precision of OP has changed to the one read from the 2270 file. Return 0 iff the import was successful. 2271 2272 Note: this function is experimental and its interface might change 2273 in future versions. 2274 2275 -- Function: void mpfr_dump (mpfr_t OP) 2276 Output OP on ���stdout��� in some unspecified format, then a newline 2277 character. This function is mainly for debugging purpose. Thus 2278 invalid data may be supported. Everything that is not specified 2279 may change without breaking the ABI and may depend on the 2280 environment. 2281 2282 The current output format is the following: a minus sign if the 2283 sign bit is set (even for NaN); ���@NaN@���, ���@Inf@��� or ���0��� if the 2284 argument is NaN, an infinity or zero, respectively; otherwise the 2285 remaining of the output is as follows: ���0.��� then the p bits of the 2286 binary significand, where p is the precision of the number; if the 2287 trailing bits are not all zeros (which must not occur with valid 2288 data), they are output enclosed by square brackets; the character 2289 ���E��� followed by the exponent written in base 10; in case of invalid 2290 data or out-of-range exponent, this function outputs three 2291 exclamation marks (���!!!���), followed by flags, followed by three 2292 exclamation marks (���!!!���) again. These flags are: ���N��� if the most 2293 significant bit of the significand is 0 (i.e., the number is not 2294 normalized); ���T��� if there are non-zero trailing bits; ���U��� if this 2295 is an UBF number (internal use only); ���<��� if the exponent is less 2296 than the current minimum exponent; ���>��� if the exponent is greater 2297 than the current maximum exponent. 2298 2299 2300File: mpfr.info, Node: Formatted Output Functions, Next: Integer and Remainder Related Functions, Prev: Input and Output Functions, Up: MPFR Interface 2301 23025.9 Formatted Output Functions 2303============================== 2304 23055.9.1 Requirements 2306------------------ 2307 2308The class of ���mpfr_printf��� functions provides formatted output in a 2309similar manner as the standard C ���printf���. These functions are defined 2310only if your system supports ISO C variadic functions and the 2311corresponding argument access macros. 2312 2313 When using any of these functions, you must include the ���<stdio.h>��� 2314standard header before ���mpfr.h���, to allow ���mpfr.h��� to define prototypes 2315for these functions. 2316 23175.9.2 Format String 2318------------------- 2319 2320The format specification accepted by ���mpfr_printf��� is an extension of 2321the ���gmp_printf��� one (itself, an extension of the ���printf��� one). The 2322conversion specification is of the form: 2323 2324 % [flags] [width] [.[precision]] [type] [rounding] conv 2325 2326 ���flags���, ���width���, and ���precision��� have the same meaning as for the 2327standard ���printf��� (in particular, notice that the precision is related 2328to the number of digits displayed in the base chosen by ���conv��� and not 2329related to the internal precision of the ���mpfr_t��� variable), but note 2330that for ���Re���, the default precision is not the same as the one for ���e���. 2331���mpfr_printf��� accepts the same ���type��� specifiers as GMP (except the 2332non-standard and deprecated ���q���, use ���ll��� instead), namely the length 2333modifiers defined in the C standard: 2334 2335 ���h��� ���short��� 2336 ���hh��� ���char��� 2337 ���j��� ���intmax_t��� or ���uintmax_t��� 2338 ���l��� ���long��� or ���wchar_t��� 2339 ���ll��� ���long long��� 2340 ���L��� ���long double��� 2341 ���t��� ���ptrdiff_t��� 2342 ���z��� ���size_t��� 2343 2344and the ���type��� specifiers defined in GMP, plus ���R��� and ���P���, which are 2345specific to MPFR (the second column in the table below shows the type of 2346the argument read in the argument list and the kind of ���conv��� specifier 2347to use after the ���type��� specifier): 2348 2349 ���F��� ���mpf_t���, float conversions 2350 ���Q��� ���mpq_t���, integer conversions 2351 ���M��� ���mp_limb_t���, integer conversions 2352 ���N��� ���mp_limb_t��� array, integer conversions 2353 ���Z��� ���mpz_t���, integer conversions 2354 2355 ���P��� ���mpfr_prec_t���, integer conversions 2356 ���R��� ���mpfr_t���, float conversions 2357 2358 The ���type��� specifiers have the same restrictions as those mentioned 2359in the GMP documentation: *note (gmp.info)Formatted Output Strings::. 2360In particular, the ���type��� specifiers (except ���R��� and ���P���) are supported 2361only if they are supported by ���gmp_printf��� in your GMP build; this 2362implies that the standard specifiers, such as ���t���, must _also_ be 2363supported by your C library if you want to use them. 2364 2365 The ���rounding��� field is specific to ���mpfr_t��� arguments and should not 2366be used with other types. 2367 2368 With conversion specification not involving ���P��� and ���R��� types, 2369���mpfr_printf��� behaves exactly as ���gmp_printf���. 2370 2371 Thus the ���conv��� specifier ���F��� is not supported (due to the use of ���F��� 2372as the ���type��� specifier for ���mpf_t���), except for the ���type��� specifier 2373���R��� (i.e., for ���mpfr_t��� arguments). 2374 2375 The ���P��� type specifies that a following ���d���, ���i���, ���o���, ���u���, ���x���, or 2376���X��� conversion specifier applies to a ���mpfr_prec_t��� argument. It is 2377needed because the ���mpfr_prec_t��� type does not necessarily correspond to 2378an ���int��� or any fixed standard type. The ���precision��� value specifies 2379the minimum number of digits to appear. The default precision is 1. 2380For example: 2381 mpfr_t x; 2382 mpfr_prec_t p; 2383 mpfr_init (x); 2384 ... 2385 p = mpfr_get_prec (x); 2386 mpfr_printf ("variable x with %Pd bits", p); 2387 2388 The ���R��� type specifies that a following ���a���, ���A���, ���b���, ���e���, ���E���, ���f���, 2389���F���, ���g���, ���G���, or ���n��� conversion specifier applies to a ���mpfr_t��� 2390argument. The ���R��� type can be followed by a ���rounding��� specifier 2391denoted by one of the following characters: 2392 2393 ���U��� round toward positive infinity 2394 ���D��� round toward negative infinity 2395 ���Y��� round away from zero 2396 ���Z��� round toward zero 2397 ���N��� round to nearest (with ties to even) 2398 ���*��� rounding mode indicated by the 2399 ���mpfr_rnd_t��� argument just before the 2400 corresponding ���mpfr_t��� variable. 2401 2402 The default rounding mode is rounding to nearest. The following 2403three examples are equivalent: 2404 mpfr_t x; 2405 mpfr_init (x); 2406 ... 2407 mpfr_printf ("%.128Rf", x); 2408 mpfr_printf ("%.128RNf", x); 2409 mpfr_printf ("%.128R*f", MPFR_RNDN, x); 2410 2411 Note that the rounding away from zero mode is specified with ���Y��� 2412because ISO C reserves the ���A��� specifier for hexadecimal output (see 2413below). 2414 2415 The output ���conv��� specifiers allowed with ���mpfr_t��� parameter are: 2416 2417 ���a��� ���A��� hex float, C99 style 2418 ���b��� binary output 2419 ���e��� ���E��� scientific-format float 2420 ���f��� ���F��� fixed-point float 2421 ���g��� ���G��� fixed-point or scientific float 2422 2423 The conversion specifier ���b���, which displays the argument in binary, 2424is specific to ���mpfr_t��� arguments and should not be used with other 2425types. Other conversion specifiers have the same meaning as for a 2426���double��� argument. 2427 2428 In case of non-decimal output, only the significand is written in the 2429specified base, the exponent is always displayed in decimal. 2430 2431 Non-real values are always displayed as ���nan��� / ���inf��� for the ���a���, 2432���b���, ���e���, ���f���, and ���g��� specifiers, and ���NAN��� / ���INF��� for ���A���, ���E���, ���F���, 2433and ���G��� specifiers, possibly preceded by a sign or a space (the minus 2434sign when the value has a negative sign, the plus sign when the value 2435has a positive sign and the ���+��� flag is used, a space when the value has 2436a positive sign and the _space_ flag is used). 2437 2438 The ���mpfr_t��� number is rounded to the given precision in the 2439direction specified by the rounding mode (see below if the precision is 2440missing). Similarly to the native C types, the precision is the number 2441of digits output after the decimal-point character, except for the ���g��� 2442and ���G��� conversion specifiers, where it is the number of significant 2443digits (but trailing zeros of the fractional part are not output by 2444default), or 1 if the precision is zero. If the precision is zero with 2445rounding to nearest mode and one of the following conversion specifiers: 2446���a���, ���A���, ���b���, ���e���, ���E���, tie case is rounded to even when it lies 2447between two consecutive values at the wanted precision which have the 2448same exponent, otherwise, it is rounded away from zero. For instance, 244985 is displayed as ���8e+1��� and 95 is displayed as ���1e+2��� with the format 2450specification ���"%.0RNe"���. This also applies when the ���g��� (resp. ���G���) 2451conversion specifier uses the ���e��� (resp. ���E���) style. If the precision 2452is set to a value greater than the maximum value for an ���int���, it will 2453be silently reduced down to ���INT_MAX���. 2454 2455 If the precision is missing, it is chosen as follows, depending on 2456the conversion specifier. 2457 ��� With ���a���, ���A���, and ���b���, it is chosen to have an exact 2458 representation with no trailing zeros. 2459 ��� With ���e��� and ���E���, it is ceil(p times log(2)/log(10)), where p is 2460 the precision of the input variable, matching the choice done for 2461 ���mpfr_get_str���; thus, if rounding to nearest is used, outputting 2462 the value with a missing precision and reading it back will yield 2463 the original value. 2464 ��� With ���f���, ���F���, ���g���, and ���G���, it is 6. 2465 24665.9.3 Functions 2467--------------- 2468 2469For all the following functions, if the number of characters that ought 2470to be written exceeds the maximum limit ���INT_MAX��� for an ���int���, nothing 2471is written in the stream (resp. to ���stdout���, to BUF, to STR), the 2472function returns ���1, sets the _erange_ flag, and ���errno��� is set to 2473���EOVERFLOW��� if the ���EOVERFLOW��� macro is defined (such as on POSIX 2474systems). Note, however, that ���errno��� might be changed to another value 2475by some internal library call if another error occurs there (currently, 2476this would come from the unallocation function). 2477 2478 -- Function: int mpfr_fprintf (FILE *STREAM, const char *TEMPLATE, ...) 2479 -- Function: int mpfr_vfprintf (FILE *STREAM, const char *TEMPLATE, 2480 va_list AP) 2481 Print to the stream STREAM the optional arguments under the control 2482 of the template string TEMPLATE. Return the number of characters 2483 written or a negative value if an error occurred. 2484 2485 -- Function: int mpfr_printf (const char *TEMPLATE, ...) 2486 -- Function: int mpfr_vprintf (const char *TEMPLATE, va_list AP) 2487 Print to ���stdout��� the optional arguments under the control of the 2488 template string TEMPLATE. Return the number of characters written 2489 or a negative value if an error occurred. 2490 2491 -- Function: int mpfr_sprintf (char *BUF, const char *TEMPLATE, ...) 2492 -- Function: int mpfr_vsprintf (char *BUF, const char *TEMPLATE, 2493 va_list AP) 2494 Form a null-terminated string corresponding to the optional 2495 arguments under the control of the template string TEMPLATE, and 2496 print it in BUF. No overlap is permitted between BUF and the other 2497 arguments. Return the number of characters written in the array 2498 BUF _not counting_ the terminating null character or a negative 2499 value if an error occurred. 2500 2501 -- Function: int mpfr_snprintf (char *BUF, size_t N, const char 2502 *TEMPLATE, ...) 2503 -- Function: int mpfr_vsnprintf (char *BUF, size_t N, const char 2504 *TEMPLATE, va_list AP) 2505 Form a null-terminated string corresponding to the optional 2506 arguments under the control of the template string TEMPLATE, and 2507 print it in BUF. If N is zero, nothing is written and BUF may be a 2508 null pointer, otherwise, the first N ��� 1 characters are written in 2509 BUF and the N-th one is a null character. Return the number of 2510 characters that would have been written had N been sufficiently 2511 large, _not counting_ the terminating null character, or a negative 2512 value if an error occurred. 2513 2514 -- Function: int mpfr_asprintf (char **STR, const char *TEMPLATE, ...) 2515 -- Function: int mpfr_vasprintf (char **STR, const char *TEMPLATE, 2516 va_list AP) 2517 Write their output as a null terminated string in a block of memory 2518 allocated using the allocation function (*note Memory Handling::). 2519 A pointer to the block is stored in STR. The block of memory must 2520 be freed using ���mpfr_free_str���. The return value is the number of 2521 characters written in the string, excluding the null-terminator, or 2522 a negative value if an error occurred, in which case the contents 2523 of STR are undefined. 2524 2525 2526File: mpfr.info, Node: Integer and Remainder Related Functions, Next: Rounding-Related Functions, Prev: Formatted Output Functions, Up: MPFR Interface 2527 25285.10 Integer and Remainder Related Functions 2529============================================ 2530 2531 -- Function: int mpfr_rint (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2532 -- Function: int mpfr_ceil (mpfr_t ROP, mpfr_t OP) 2533 -- Function: int mpfr_floor (mpfr_t ROP, mpfr_t OP) 2534 -- Function: int mpfr_round (mpfr_t ROP, mpfr_t OP) 2535 -- Function: int mpfr_roundeven (mpfr_t ROP, mpfr_t OP) 2536 -- Function: int mpfr_trunc (mpfr_t ROP, mpfr_t OP) 2537 Set ROP to OP rounded to an integer. ���mpfr_rint��� rounds to the 2538 nearest representable integer in the given direction RND, and the 2539 other five functions behave in a similar way with some fixed 2540 rounding mode: 2541 ��� ���mpfr_ceil���: to the next higher or equal representable integer 2542 (like ���mpfr_rint��� with ���MPFR_RNDU���); 2543 ��� ���mpfr_floor��� to the next lower or equal representable integer 2544 (like ���mpfr_rint��� with ���MPFR_RNDD���); 2545 ��� ���mpfr_round��� to the nearest representable integer, rounding 2546 halfway cases away from zero (as in the roundTiesToAway mode 2547 of IEEE 754); 2548 ��� ���mpfr_roundeven��� to the nearest representable integer, 2549 rounding halfway cases with the even-rounding rule (like 2550 ���mpfr_rint��� with ���MPFR_RNDN���); 2551 ��� ���mpfr_trunc��� to the next representable integer toward zero 2552 (like ���mpfr_rint��� with ���MPFR_RNDZ���). 2553 When OP is a zero or an infinity, set ROP to the same value (with 2554 the same sign). 2555 2556 The return value is zero when the result is exact, positive when it 2557 is greater than the original value of OP, and negative when it is 2558 smaller. More precisely, the return value is 0 when OP is an 2559 integer representable in ROP, 1 or ���1 when OP is an integer that is 2560 not representable in ROP, 2 or ���2 when OP is not an integer. 2561 2562 When OP is NaN, the NaN flag is set as usual. In the other cases, 2563 the inexact flag is set when ROP differs from OP, following the ISO 2564 C99 rule for the ���rint��� function. If you want the behavior to be 2565 more like IEEE 754 / ISO TS 18661-1, i.e., the usual behavior where 2566 the round-to-integer function is regarded as any other mathematical 2567 function, you should use one of the ���mpfr_rint_*��� functions 2568 instead. 2569 2570 Note that no double rounding is performed; for instance, 10.5 2571 (1010.1 in binary) is rounded by ���mpfr_rint��� with rounding to 2572 nearest to 12 (1100 in binary) in 2-bit precision, because the two 2573 enclosing numbers representable on two bits are 8 and 12, and the 2574 closest is 12. (If one first rounded to an integer, one would 2575 round 10.5 to 10 with even rounding, and then 10 would be rounded 2576 to 8 again with even rounding.) 2577 2578 -- Function: int mpfr_rint_ceil (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2579 -- Function: int mpfr_rint_floor (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t 2580 RND) 2581 -- Function: int mpfr_rint_round (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t 2582 RND) 2583 -- Function: int mpfr_rint_roundeven (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t 2584 RND) 2585 -- Function: int mpfr_rint_trunc (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t 2586 RND) 2587 Set ROP to OP rounded to an integer: 2588 ��� ���mpfr_rint_ceil���: to the next higher or equal integer; 2589 ��� ���mpfr_rint_floor���: to the next lower or equal integer; 2590 ��� ���mpfr_rint_round���: to the nearest integer, rounding halfway 2591 cases away from zero; 2592 ��� ���mpfr_rint_roundeven���: to the nearest integer, rounding 2593 halfway cases to the nearest even integer; 2594 ��� ���mpfr_rint_trunc��� to the next integer toward zero. 2595 If the result is not representable, it is rounded in the direction 2596 RND. When OP is a zero or an infinity, set ROP to the same value 2597 (with the same sign). The return value is the ternary value 2598 associated with the considered round-to-integer function (regarded 2599 in the same way as any other mathematical function). 2600 2601 Contrary to ���mpfr_rint���, those functions do perform a double 2602 rounding: first OP is rounded to the nearest integer in the 2603 direction given by the function name, then this nearest integer (if 2604 not representable) is rounded in the given direction RND. Thus 2605 these round-to-integer functions behave more like the other 2606 mathematical functions, i.e., the returned result is the correct 2607 rounding of the exact result of the function in the real numbers. 2608 2609 For example, ���mpfr_rint_round��� with rounding to nearest and a 2610 precision of two bits rounds 6.5 to 7 (halfway cases away from 2611 zero), then 7 is rounded to 8 by the round-even rule, despite the 2612 fact that 6 is also representable on two bits, and is closer to 6.5 2613 than 8. 2614 2615 -- Function: int mpfr_frac (mpfr_t ROP, mpfr_t OP, mpfr_rnd_t RND) 2616 Set ROP to the fractional part of OP, having the same sign as OP, 2617 rounded in the direction RND (unlike in ���mpfr_rint���, RND affects 2618 only how the exact fractional part is rounded, not how the 2619 fractional part is generated). When OP is an integer or an 2620 infinity, set ROP to zero with the same sign as OP. 2621 2622 -- Function: int mpfr_modf (mpfr_t IOP, mpfr_t FOP, mpfr_t OP, 2623 mpfr_rnd_t RND) 2624 Set simultaneously IOP to the integral part of OP and FOP to the 2625 fractional part of OP, rounded in the direction RND with the 2626 corresponding precision of IOP and FOP (equivalent to 2627 ���mpfr_trunc(IOP, OP, RND)��� and ���mpfr_frac(FOP, OP, RND)���). The 2628 variables IOP and FOP must be different. Return 0 iff both results 2629 are exact (see ���mpfr_sin_cos��� for a more detailed description of 2630 the return value). 2631 2632 -- Function: int mpfr_fmod (mpfr_t R, mpfr_t X, mpfr_t Y, mpfr_rnd_t 2633 RND) 2634 -- Function: int mpfr_fmod_ui (mpfr_t R, mpfr_t X, unsigned long int Y, 2635 mpfr_rnd_t RND) 2636 -- Function: int mpfr_fmodquo (mpfr_t R, long int* Q, mpfr_t X, mpfr_t 2637 Y, mpfr_rnd_t RND) 2638 -- Function: int mpfr_remainder (mpfr_t R, mpfr_t X, mpfr_t Y, 2639 mpfr_rnd_t RND) 2640 -- Function: int mpfr_remquo (mpfr_t R, long int* Q, mpfr_t X, mpfr_t 2641 Y, mpfr_rnd_t RND) 2642 Set R to the value of X ��� NY, rounded according to the direction 2643 RND, where N is the integer quotient of X divided by Y, defined as 2644 follows: N is rounded toward zero for ���mpfr_fmod���, ���mpfr_fmod_ui��� 2645 and ���mpfr_fmodquo���, and to the nearest integer (ties rounded to 2646 even) for ���mpfr_remainder��� and ���mpfr_remquo���. 2647 2648 Special values are handled as described in Section F.9.7.1 of the 2649 ISO C99 standard: If X is infinite or Y is zero, R is NaN. If Y is 2650 infinite and X is finite, R is X rounded to the precision of R. If 2651 R is zero, it has the sign of X. The return value is the ternary 2652 value corresponding to R. 2653 2654 Additionally, ���mpfr_fmodquo��� and ���mpfr_remquo��� store the low 2655 significant bits from the quotient N in *Q (more precisely the 2656 number of bits in a ���long int��� minus one), with the sign of X 2657 divided by Y (except if those low bits are all zero, in which case 2658 zero is returned). If the result is NaN, the value of *Q is 2659 unspecified. Note that X may be so large in magnitude relative to 2660 Y that an exact representation of the quotient is not practical. 2661 The ���mpfr_remainder��� and ���mpfr_remquo��� functions are useful for 2662 additive argument reduction. 2663 2664 -- Function: int mpfr_integer_p (mpfr_t OP) 2665 Return non-zero iff OP is an integer. 2666 2667 2668File: mpfr.info, Node: Rounding-Related Functions, Next: Miscellaneous Functions, Prev: Integer and Remainder Related Functions, Up: MPFR Interface 2669 26705.11 Rounding-Related Functions 2671=============================== 2672 2673 -- Function: void mpfr_set_default_rounding_mode (mpfr_rnd_t RND) 2674 Set the default rounding mode to RND. The default rounding mode is 2675 to nearest initially. 2676 2677 -- Function: mpfr_rnd_t mpfr_get_default_rounding_mode (void) 2678 Get the default rounding mode. 2679 2680 -- Function: int mpfr_prec_round (mpfr_t X, mpfr_prec_t PREC, 2681 mpfr_rnd_t RND) 2682 Round X according to RND with precision PREC, which must be an 2683 integer between ���MPFR_PREC_MIN��� and ���MPFR_PREC_MAX��� (otherwise the 2684 behavior is undefined). If PREC is greater than or equal to the 2685 precision of X, then new space is allocated for the significand, 2686 and it is filled with zeros. Otherwise, the significand is rounded 2687 to precision PREC with the given direction; no memory reallocation 2688 to free the unused limbs is done. In both cases, the precision of 2689 X is changed to PREC. 2690 2691 Here is an example of how to use ���mpfr_prec_round��� to implement 2692 Newton���s algorithm to compute the inverse of A, assuming X is 2693 already an approximation to N bits: 2694 mpfr_set_prec (t, 2 * n); 2695 mpfr_set (t, a, MPFR_RNDN); /* round a to 2n bits */ 2696 mpfr_mul (t, t, x, MPFR_RNDN); /* t is correct to 2n bits */ 2697 mpfr_ui_sub (t, 1, t, MPFR_RNDN); /* high n bits cancel with 1 */ 2698 mpfr_prec_round (t, n, MPFR_RNDN); /* t is correct to n bits */ 2699 mpfr_mul (t, t, x, MPFR_RNDN); /* t is correct to n bits */ 2700 mpfr_prec_round (x, 2 * n, MPFR_RNDN); /* exact */ 2701 mpfr_add (x, x, t, MPFR_RNDN); /* x is correct to 2n bits */ 2702 2703 Warning! You must not use this function if X was initialized with 2704 ���MPFR_DECL_INIT��� or with ���mpfr_custom_init_set��� (*note Custom 2705 Interface::). 2706 2707 -- Function: int mpfr_can_round (mpfr_t B, mpfr_exp_t ERR, mpfr_rnd_t 2708 RND1, mpfr_rnd_t RND2, mpfr_prec_t PREC) 2709 Assuming B is an approximation of an unknown number X in the 2710 direction RND1 with error at most two to the power EXP(B) ��� ERR 2711 where EXP(B) is the exponent of B, return a non-zero value if one 2712 is able to round correctly X to precision PREC with the direction 2713 RND2 assuming an unbounded exponent range, and 0 otherwise 2714 (including for NaN and Inf). In other words, if the error on B is 2715 bounded by two to the power K ulps, and B has precision PREC, you 2716 should give ERR = PREC ��� K. This function *does not modify* its 2717 arguments. 2718 2719 If RND1 is ���MPFR_RNDN��� or ���MPFR_RNDF���, the error is considered to 2720 be either positive or negative, thus the possible range is twice as 2721 large as with a directed rounding for RND1 (with the same value of 2722 ERR). 2723 2724 When RND2 is ���MPFR_RNDF���, let RND3 be the opposite direction if 2725 RND1 is a directed rounding, and ���MPFR_RNDN��� if RND1 is ���MPFR_RNDN��� 2726 or ���MPFR_RNDF���. The returned value of ���mpfr_can_round (b, err, 2727 rnd1, MPFR_RNDF, prec)��� is non-zero iff after the call ���mpfr_set 2728 (y, b, rnd3)��� with Y of precision PREC, Y is guaranteed to be a 2729 faithful rounding of X. 2730 2731 Note: The *note ternary value:: cannot be determined in general 2732 with this function. However, if it is known that the exact value 2733 is not exactly representable in precision PREC, then one can use 2734 the following trick to determine the (non-zero) ternary value in 2735 any rounding mode RND2 (note that ���MPFR_RNDZ��� below can be replaced 2736 by any directed rounding mode): 2737 if (mpfr_can_round (b, err, MPFR_RNDN, MPFR_RNDZ, 2738 prec + (rnd2 == MPFR_RNDN))) 2739 { 2740 /* round the approximation b to the result r of prec bits 2741 with rounding mode rnd2 and get the ternary value inex */ 2742 inex = mpfr_set (r, b, rnd2); 2743 } 2744 Indeed, if RND2 is ���MPFR_RNDN���, this will check if one can round to 2745 PREC + 1 bits with a directed rounding: if so, one can surely round 2746 to nearest to PREC bits, and in addition one can determine the 2747 correct ternary value, which would not be the case when B is near 2748 from a value exactly representable on PREC bits. 2749 2750 A detailed example is available in the ���examples��� subdirectory, 2751 file ���can_round.c���. 2752 2753 -- Function: mpfr_prec_t mpfr_min_prec (mpfr_t X) 2754 Return the minimal number of bits required to store the significand 2755 of X, and 0 for special values, including 0. 2756 2757 -- Function: const char * mpfr_print_rnd_mode (mpfr_rnd_t RND) 2758 Return a string (���"MPFR_RNDN"���, ���"MPFR_RNDZ"���, ���"MPFR_RNDU"���, 2759 ���"MPFR_RNDD"���, ���"MPFR_RNDA"���, ���"MPFR_RNDF"���) corresponding to the 2760 rounding mode RND, or a null pointer if RND is an invalid rounding 2761 mode. 2762 2763 -- Macro: int mpfr_round_nearest_away (int (FOO)(mpfr_t, type1_t, ..., 2764 mpfr_rnd_t), mpfr_t ROP, type1_t OP, ...) 2765 Given a function FOO and one or more values OP (which may be a 2766 ���mpfr_t���, a ���long int���, a ���double���, etc.), put in ROP the 2767 round-to-nearest-away rounding of ���FOO(OP,...)���. This rounding is 2768 defined in the same way as round-to-nearest-even, except in case of 2769 tie, where the value away from zero is returned. The function FOO 2770 takes as input, from second to penultimate argument(s), the 2771 argument list given after ROP, a rounding mode as final argument, 2772 puts in its first argument the value ���FOO(OP,...)��� rounded 2773 according to this rounding mode, and returns the corresponding 2774 ternary value (which is expected to be correct, otherwise 2775 ���mpfr_round_nearest_away��� will not work as desired). Due to 2776 implementation constraints, this function must not be called when 2777 the minimal exponent EMIN is the smallest possible one. This macro 2778 has been made such that the compiler is able to detect mismatch 2779 between the argument list OP and the function prototype of FOO. 2780 Multiple input arguments OP are supported only with C99 compilers. 2781 Otherwise, for C90 compilers, only one such argument is supported. 2782 2783 Note: this macro is experimental and its interface might change in 2784 future versions. 2785 unsigned long ul; 2786 mpfr_t f, r; 2787 /* Code that inits and sets r, f, and ul, and if needed sets emin */ 2788 int i = mpfr_round_nearest_away (mpfr_add_ui, r, f, ul); 2789 2790 2791File: mpfr.info, Node: Miscellaneous Functions, Next: Exception Related Functions, Prev: Rounding-Related Functions, Up: MPFR Interface 2792 27935.12 Miscellaneous Functions 2794============================ 2795 2796 -- Function: void mpfr_nexttoward (mpfr_t X, mpfr_t Y) 2797 If X or Y is NaN, set X to NaN; note that the NaN flag is set as 2798 usual. If X and Y are equal, X is unchanged. Otherwise, if X is 2799 different from Y, replace X by the next floating-point number (with 2800 the precision of X and the current exponent range) in the direction 2801 of Y (the infinite values are seen as the smallest and largest 2802 floating-point numbers). If the result is zero, it keeps the same 2803 sign. No underflow, overflow, or inexact exception is raised. 2804 2805 Note: Concerning the exceptions and the sign of 0, the behavior 2806 differs from the ISO C ���nextafter��� and ���nexttoward��� functions. It 2807 is similar to the nextUp and nextDown operations from IEEE 754 2808 (introduced in its 2008 revision). 2809 2810 -- Function: void mpfr_nextabove (mpfr_t X) 2811 -- Function: void mpfr_nextbelow (mpfr_t X) 2812 Equivalent to ���mpfr_nexttoward��� where Y is +Inf (resp. ���Inf). 2813 2814 -- Function: int mpfr_min (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, 2815 mpfr_rnd_t RND) 2816 -- Function: int mpfr_max (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, 2817 mpfr_rnd_t RND) 2818 Set ROP to the minimum (resp. maximum) of OP1 and OP2. If OP1 and 2819 OP2 are both NaN, then ROP is set to NaN. If OP1 or OP2 is NaN, 2820 then ROP is set to the numeric value. If OP1 and OP2 are zeros of 2821 different signs, then ROP is set to ���0 (resp. +0). As usual, the 2822 NaN flag is set only when the result is NaN, i.e., when both OP1 2823 and OP2 are NaN. 2824 2825 Note: These functions correspond to the minimumNumber and 2826 maximumNumber operations of IEEE 754-2019 for the result. But in 2827 MPFR, the NaN flag is set only when _both_ operands are NaN. 2828 2829 -- Function: int mpfr_urandomb (mpfr_t ROP, gmp_randstate_t STATE) 2830 Generate a uniformly distributed random float in the interval 2831 0 <= ROP < 1. More precisely, the number can be seen as a float 2832 with a random non-normalized significand and exponent 0, which is 2833 then normalized (thus if E denotes the exponent after 2834 normalization, then the least ���E significant bits of the 2835 significand are always 0). 2836 2837 Return 0, unless the exponent is not in the current exponent range, 2838 in which case ROP is set to NaN and a non-zero value is returned 2839 (this should never happen in practice, except in very specific 2840 cases). The second argument is a ���gmp_randstate_t��� structure, 2841 which should be created using the GMP ���gmp_randinit��� function (see 2842 the GMP manual). 2843 2844 Note: for a given version of MPFR, the returned value of ROP and 2845 the new value of STATE (which controls further random values) do 2846 not depend on the machine word size. 2847 2848 -- Function: int mpfr_urandom (mpfr_t ROP, gmp_randstate_t STATE, 2849 mpfr_rnd_t RND) 2850 Generate a uniformly distributed random float. The floating-point 2851 number ROP can be seen as if a random real number is generated 2852 according to the continuous uniform distribution on the interval 2853 [0, 1] and then rounded in the direction RND. 2854 2855 The second argument is a ���gmp_randstate_t��� structure, which should 2856 be created using the GMP ���gmp_randinit��� function (see the GMP 2857 manual). 2858 2859 Note: the note for ���mpfr_urandomb��� holds too. Moreover, the exact 2860 number (the random value to be rounded) and the next random state 2861 do not depend on the current exponent range and the rounding mode. 2862 However, they depend on the target precision: from the same state 2863 of the random generator, if the precision of the destination is 2864 changed, then the value may be completely different (and the state 2865 of the random generator is different too). 2866 2867 -- Function: int mpfr_nrandom (mpfr_t ROP1, gmp_randstate_t STATE, 2868 mpfr_rnd_t RND) 2869 -- Function: int mpfr_grandom (mpfr_t ROP1, mpfr_t ROP2, 2870 gmp_randstate_t STATE, mpfr_rnd_t RND) 2871 Generate one (possibly two for ���mpfr_grandom���) random 2872 floating-point number according to a standard normal Gaussian 2873 distribution (with mean zero and variance one). For 2874 ���mpfr_grandom���, if ROP2 is a null pointer, then only one value is 2875 generated and stored in ROP1. 2876 2877 The floating-point number ROP1 (and ROP2) can be seen as if a 2878 random real number were generated according to the standard normal 2879 Gaussian distribution and then rounded in the direction RND. 2880 2881 The ���gmp_randstate_t��� argument should be created using the GMP 2882 ���gmp_randinit��� function (see the GMP manual). 2883 2884 For ���mpfr_grandom���, the combination of the ternary values is 2885 returned like with ���mpfr_sin_cos���. If ROP2 is a null pointer, the 2886 second ternary value is assumed to be 0 (note that the encoding of 2887 the only ternary value is not the same as the usual encoding for 2888 functions that return only one result). Otherwise the ternary 2889 value of a random number is always non-zero. 2890 2891 Note: the note for ���mpfr_urandomb��� holds too. In addition, the 2892 exponent range and the rounding mode might have a side effect on 2893 the next random state. 2894 2895 Note: ���mpfr_nrandom��� is much more efficient than ���mpfr_grandom���, 2896 especially for large precision. Thus ���mpfr_grandom��� is marked as 2897 deprecated and will be removed in a future release. 2898 2899 -- Function: int mpfr_erandom (mpfr_t ROP1, gmp_randstate_t STATE, 2900 mpfr_rnd_t RND) 2901 Generate one random floating-point number according to an 2902 exponential distribution, with mean one. Other characteristics are 2903 identical to ���mpfr_nrandom���. 2904 2905 -- Function: mpfr_exp_t mpfr_get_exp (mpfr_t X) 2906 Return the exponent of X, assuming that X is a non-zero ordinary 2907 number and the significand is considered in [1/2,1). For this 2908 function, X is allowed to be outside of the current range of 2909 acceptable values. The behavior for NaN, infinity or zero is 2910 undefined. 2911 2912 -- Function: int mpfr_set_exp (mpfr_t X, mpfr_exp_t E) 2913 Set the exponent of X to E if X is a non-zero ordinary number and E 2914 is in the current exponent range, and return 0; otherwise, return a 2915 non-zero value (X is not changed). 2916 2917 -- Function: int mpfr_signbit (mpfr_t OP) 2918 Return a non-zero value iff OP has its sign bit set (i.e., if it is 2919 negative, ���0, or a NaN whose representation has its sign bit set). 2920 2921 -- Function: int mpfr_setsign (mpfr_t ROP, mpfr_t OP, int S, mpfr_rnd_t 2922 RND) 2923 Set the value of ROP from OP, rounded toward the given direction 2924 RND, then set (resp. clear) its sign bit if S is non-zero (resp. 2925 zero), even when OP is a NaN. 2926 2927 -- Function: int mpfr_copysign (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, 2928 mpfr_rnd_t RND) 2929 Set the value of ROP from OP1, rounded toward the given direction 2930 RND, then set its sign bit to that of OP2 (even when OP1 or OP2 is 2931 a NaN). This function is equivalent to ���mpfr_setsign (ROP, OP1, 2932 mpfr_signbit (OP2), RND)���. 2933 2934 -- Function: const char * mpfr_get_version (void) 2935 Return the MPFR version, as a null-terminated string. 2936 2937 -- Macro: MPFR_VERSION 2938 -- Macro: MPFR_VERSION_MAJOR 2939 -- Macro: MPFR_VERSION_MINOR 2940 -- Macro: MPFR_VERSION_PATCHLEVEL 2941 -- Macro: MPFR_VERSION_STRING 2942 ���MPFR_VERSION��� is the version of MPFR as a preprocessing constant. 2943 ���MPFR_VERSION_MAJOR���, ���MPFR_VERSION_MINOR��� and 2944 ���MPFR_VERSION_PATCHLEVEL��� are respectively the major, minor and 2945 patch level of MPFR version, as preprocessing constants. 2946 ���MPFR_VERSION_STRING��� is the version (with an optional suffix, used 2947 in development and pre-release versions) as a string constant, 2948 which can be compared to the result of ���mpfr_get_version��� to check 2949 at run time the header file and library used match: 2950 if (strcmp (mpfr_get_version (), MPFR_VERSION_STRING)) 2951 fprintf (stderr, "Warning: header and library do not match\n"); 2952 Note: Obtaining different strings is not necessarily an error, as 2953 in general, a program compiled with some old MPFR version can be 2954 dynamically linked with a newer MPFR library version (if allowed by 2955 the library versioning system). 2956 2957 -- Macro: long MPFR_VERSION_NUM (MAJOR, MINOR, PATCHLEVEL) 2958 Create an integer in the same format as used by ���MPFR_VERSION��� from 2959 the given MAJOR, MINOR and PATCHLEVEL. Here is an example of how 2960 to check the MPFR version at compile time: 2961 #if (!defined(MPFR_VERSION) || (MPFR_VERSION < MPFR_VERSION_NUM(3,0,0))) 2962 # error "Wrong MPFR version." 2963 #endif 2964 2965 -- Function: const char * mpfr_get_patches (void) 2966 Return a null-terminated string containing the ids of the patches 2967 applied to the MPFR library (contents of the ���PATCHES��� file), 2968 separated by spaces. Note: If the program has been compiled with 2969 an older MPFR version and is dynamically linked with a new MPFR 2970 library version, the identifiers of the patches applied to the old 2971 (compile-time) MPFR version are not available (however, this 2972 information should not have much interest in general). 2973 2974 -- Function: int mpfr_buildopt_tls_p (void) 2975 Return a non-zero value if MPFR was compiled as thread safe using 2976 compiler-level Thread-Local Storage (that is, MPFR was built with 2977 the ���--enable-thread-safe��� configure option, see ���INSTALL��� file), 2978 return zero otherwise. 2979 2980 -- Function: int mpfr_buildopt_float128_p (void) 2981 Return a non-zero value if MPFR was compiled with ���_Float128��� 2982 support (that is, MPFR was built with the ���--enable-float128��� 2983 configure option), return zero otherwise. 2984 2985 -- Function: int mpfr_buildopt_decimal_p (void) 2986 Return a non-zero value if MPFR was compiled with decimal float 2987 support (that is, MPFR was built with the ���--enable-decimal-float��� 2988 configure option), return zero otherwise. 2989 2990 -- Function: int mpfr_buildopt_gmpinternals_p (void) 2991 Return a non-zero value if MPFR was compiled with GMP internals 2992 (that is, MPFR was built with either ���--with-gmp-build��� or 2993 ���--enable-gmp-internals��� configure option), return zero otherwise. 2994 2995 -- Function: int mpfr_buildopt_sharedcache_p (void) 2996 Return a non-zero value if MPFR was compiled so that all threads 2997 share the same cache for one MPFR constant, like ���mpfr_const_pi��� or 2998 ���mpfr_const_log2��� (that is, MPFR was built with the 2999 ���--enable-shared-cache��� configure option), return zero otherwise. 3000 If the return value is non-zero, MPFR applications may need to be 3001 compiled with the ���-pthread��� option. 3002 3003 -- Function: const char * mpfr_buildopt_tune_case (void) 3004 Return a string saying which thresholds file has been used at 3005 compile time. This file is normally selected from the processor 3006 type. 3007 3008 3009File: mpfr.info, Node: Exception Related Functions, Next: Memory Handling Functions, Prev: Miscellaneous Functions, Up: MPFR Interface 3010 30115.13 Exception Related Functions 3012================================ 3013 3014 -- Function: mpfr_exp_t mpfr_get_emin (void) 3015 -- Function: mpfr_exp_t mpfr_get_emax (void) 3016 Return the (current) smallest and largest exponents allowed for a 3017 floating-point variable. The smallest positive value of a 3018 floating-point variable is one half times 2 raised to the smallest 3019 exponent and the largest value has the form (1 ��� epsilon) times 2 3020 raised to the largest exponent, where epsilon depends on the 3021 precision of the considered variable. 3022 3023 -- Function: int mpfr_set_emin (mpfr_exp_t EXP) 3024 -- Function: int mpfr_set_emax (mpfr_exp_t EXP) 3025 Set the smallest and largest exponents allowed for a floating-point 3026 variable. Return a non-zero value when EXP is not in the range 3027 accepted by the implementation (in that case the smallest or 3028 largest exponent is not changed), and zero otherwise. 3029 3030 For the subsequent operations, it is the user���s responsibility to 3031 check that any floating-point value used as an input is in the new 3032 exponent range (for example using ���mpfr_check_range���). If a 3033 floating-point value outside the new exponent range is used as an 3034 input, the default behavior is undefined, in the sense of the ISO C 3035 standard; the behavior may also be explicitly documented, such as 3036 for ���mpfr_check_range���. 3037 3038 Note: Caches may still have values outside the current exponent 3039 range. This is not an issue as the user cannot use these caches 3040 directly via the API (MPFR extends the exponent range internally 3041 when need be). 3042 3043 If EMIN > EMAX and a floating-point value needs to be produced as 3044 output, the behavior is undefined (���mpfr_set_emin��� and 3045 ���mpfr_set_emax��� do not check this condition as it might occur 3046 between successive calls to these two functions). 3047 3048 -- Function: mpfr_exp_t mpfr_get_emin_min (void) 3049 -- Function: mpfr_exp_t mpfr_get_emin_max (void) 3050 -- Function: mpfr_exp_t mpfr_get_emax_min (void) 3051 -- Function: mpfr_exp_t mpfr_get_emax_max (void) 3052 Return the minimum and maximum of the exponents allowed for 3053 ���mpfr_set_emin��� and ���mpfr_set_emax��� respectively. These values are 3054 implementation dependent, thus a program using 3055 ���mpfr_set_emax(mpfr_get_emax_max())��� or 3056 ���mpfr_set_emin(mpfr_get_emin_min())��� may not be portable. 3057 3058 -- Function: int mpfr_check_range (mpfr_t X, int T, mpfr_rnd_t RND) 3059 This function assumes that X is the correctly rounded value of some 3060 real value Y in the direction RND and some extended exponent range, 3061 and that T is the corresponding *note ternary value::. For 3062 example, one performed ���t = mpfr_log (x, u, rnd)���, and Y is the 3063 exact logarithm of U. Thus T is negative if X is smaller than Y, 3064 positive if X is larger than Y, and zero if X equals Y. This 3065 function modifies X if needed to be in the current range of 3066 acceptable values: It generates an underflow or an overflow if the 3067 exponent of X is outside the current allowed range; the value of T 3068 may be used to avoid a double rounding. This function returns zero 3069 if the new value of X equals the exact one Y, a positive value if 3070 that new value is larger than Y, and a negative value if it is 3071 smaller than Y. Note that unlike most functions, the new result X 3072 is compared to the (unknown) exact one Y, not the input value X, 3073 i.e., the ternary value is propagated. 3074 3075 Note: If X is an infinity and T is different from zero (i.e., if 3076 the rounded result is an inexact infinity), then the overflow flag 3077 is set. This is useful because ���mpfr_check_range��� is typically 3078 called (at least in MPFR functions) after restoring the flags that 3079 could have been set due to internal computations. 3080 3081 -- Function: int mpfr_subnormalize (mpfr_t X, int T, mpfr_rnd_t RND) 3082 This function rounds X emulating subnormal number arithmetic: if X 3083 is outside the subnormal exponent range of the emulated 3084 floating-point system, this function just propagates the *note 3085 ternary value:: T; otherwise, if EXP(X) denotes the exponent of X, 3086 it rounds X to precision EXP(X)���EMIN+1 according to rounding mode 3087 RND and previous ternary value T, avoiding double rounding 3088 problems. More precisely in the subnormal domain, denoting by e 3089 the value of EMIN, X is rounded in fixed-point arithmetic to an 3090 integer multiple of two to the power e ��� 1; as a consequence, 1.5 3091 multiplied by two to the power e ��� 1 when T is zero is rounded to 3092 two to the power e with rounding to nearest. 3093 3094 The precision PREC(X) of X is not modified by this function. RND 3095 and T must be the rounding mode and the returned ternary value used 3096 when computing X (as in ���mpfr_check_range���). The subnormal 3097 exponent range is from EMIN to EMIN+PREC(X)���1. If the result 3098 cannot be represented in the current exponent range of MPFR (due to 3099 a too small EMAX), the behavior is undefined. Note that unlike 3100 most functions, the result is compared to the exact one, not the 3101 input value X, i.e., the ternary value is propagated. 3102 3103 As usual, if the returned ternary value is non zero, the inexact 3104 flag is set. Moreover, if a second rounding occurred (because the 3105 input X was in the subnormal range), the underflow flag is set. 3106 3107 Warning! If you change EMIN (with ���mpfr_set_emin���) just before 3108 calling ���mpfr_subnormalize���, you need to make sure that the value 3109 is in the current exponent range of MPFR. But it is better to 3110 change EMIN before any computation, if possible. 3111 3112 This is an example of how to emulate binary64 IEEE 754 arithmetic 3113(a.k.a. double precision) using MPFR: 3114 3115 { 3116 mpfr_t xa, xb; int i; volatile double a, b; 3117 3118 mpfr_set_default_prec (53); 3119 mpfr_set_emin (-1073); mpfr_set_emax (1024); 3120 3121 mpfr_init (xa); mpfr_init (xb); 3122 3123 b = 34.3; mpfr_set_d (xb, b, MPFR_RNDN); 3124 a = 0x1.1235P-1021; mpfr_set_d (xa, a, MPFR_RNDN); 3125 3126 a /= b; 3127 i = mpfr_div (xa, xa, xb, MPFR_RNDN); 3128 i = mpfr_subnormalize (xa, i, MPFR_RNDN); /* new ternary value */ 3129 3130 mpfr_clear (xa); mpfr_clear (xb); 3131 } 3132 3133 Note that ���mpfr_set_emin��� and ���mpfr_set_emax��� are called early enough 3134in order to make sure that all computed values are in the current 3135exponent range. Warning! This emulates a double IEEE 754 arithmetic 3136with correct rounding in the subnormal range, which may not be the case 3137for your hardware. 3138 3139 Below is another example showing how to emulate fixed-point 3140arithmetic in a specific case. Here we compute the sine of the integers 31411 to 17 with a result in a fixed-point arithmetic rounded at two to the 3142power ���42 (using the fact that the result is at most 1 in absolute 3143value): 3144 3145 { 3146 mpfr_t x; int i, inex; 3147 3148 mpfr_set_emin (-41); 3149 mpfr_init2 (x, 42); 3150 for (i = 1; i <= 17; i++) 3151 { 3152 mpfr_set_ui (x, i, MPFR_RNDN); 3153 inex = mpfr_sin (x, x, MPFR_RNDZ); 3154 mpfr_subnormalize (x, inex, MPFR_RNDZ); 3155 mpfr_dump (x); 3156 } 3157 mpfr_clear (x); 3158 } 3159 3160 -- Function: void mpfr_clear_underflow (void) 3161 -- Function: void mpfr_clear_overflow (void) 3162 -- Function: void mpfr_clear_divby0 (void) 3163 -- Function: void mpfr_clear_nanflag (void) 3164 -- Function: void mpfr_clear_inexflag (void) 3165 -- Function: void mpfr_clear_erangeflag (void) 3166 Clear (lower) the underflow, overflow, divide-by-zero, invalid, 3167 inexact and _erange_ flags. 3168 3169 -- Function: void mpfr_clear_flags (void) 3170 Clear (lower) all global flags (underflow, overflow, 3171 divide-by-zero, invalid, inexact, _erange_). Note: a group of 3172 flags can be cleared by using ���mpfr_flags_clear���. 3173 3174 -- Function: void mpfr_set_underflow (void) 3175 -- Function: void mpfr_set_overflow (void) 3176 -- Function: void mpfr_set_divby0 (void) 3177 -- Function: void mpfr_set_nanflag (void) 3178 -- Function: void mpfr_set_inexflag (void) 3179 -- Function: void mpfr_set_erangeflag (void) 3180 Set (raise) the underflow, overflow, divide-by-zero, invalid, 3181 inexact and _erange_ flags. 3182 3183 -- Function: int mpfr_underflow_p (void) 3184 -- Function: int mpfr_overflow_p (void) 3185 -- Function: int mpfr_divby0_p (void) 3186 -- Function: int mpfr_nanflag_p (void) 3187 -- Function: int mpfr_inexflag_p (void) 3188 -- Function: int mpfr_erangeflag_p (void) 3189 Return the corresponding (underflow, overflow, divide-by-zero, 3190 invalid, inexact, _erange_) flag, which is non-zero iff the flag is 3191 set. 3192 3193 The ���mpfr_flags_��� functions below that take an argument MASK can 3194operate on any subset of the exception flags: a flag is part of this 3195subset (or group) if and only if the corresponding bit of the argument 3196MASK is set. The ���MPFR_FLAGS_��� macros will normally be used to build 3197this argument. *Note Exceptions::. 3198 3199 -- Function: void mpfr_flags_clear (mpfr_flags_t MASK) 3200 Clear (lower) the group of flags specified by MASK. 3201 3202 -- Function: void mpfr_flags_set (mpfr_flags_t MASK) 3203 Set (raise) the group of flags specified by MASK. 3204 3205 -- Function: mpfr_flags_t mpfr_flags_test (mpfr_flags_t MASK) 3206 Return the flags specified by MASK. To test whether any flag from 3207 MASK is set, compare the return value to 0. You can also test 3208 individual flags by AND���ing the result with ���MPFR_FLAGS_��� macros. 3209 Example: 3210 mpfr_flags_t t = mpfr_flags_test (MPFR_FLAGS_UNDERFLOW| 3211 MPFR_FLAGS_OVERFLOW) 3212 ... 3213 if (t) /* underflow and/or overflow (unlikely) */ 3214 { 3215 if (t & MPFR_FLAGS_UNDERFLOW) { /* handle underflow */ } 3216 if (t & MPFR_FLAGS_OVERFLOW) { /* handle overflow */ } 3217 } 3218 3219 -- Function: mpfr_flags_t mpfr_flags_save (void) 3220 Return all the flags. It is equivalent to 3221 ���mpfr_flags_test(MPFR_FLAGS_ALL)���. 3222 3223 -- Function: void mpfr_flags_restore (mpfr_flags_t FLAGS, mpfr_flags_t 3224 MASK) 3225 Restore the flags specified by MASK to their state represented in 3226 FLAGS. 3227 3228 3229File: mpfr.info, Node: Memory Handling Functions, Next: Compatibility with MPF, Prev: Exception Related Functions, Up: MPFR Interface 3230 32315.14 Memory Handling Functions 3232============================== 3233 3234These are general functions concerning memory handling (*note Memory 3235Handling::, for more information). 3236 3237 -- Function: void mpfr_free_cache (void) 3238 Free all caches and pools used by MPFR internally (those local to 3239 the current thread and those shared by all threads). You should 3240 call this function before terminating a thread, even if you did not 3241 call ���mpfr_const_*��� functions directly (they could have been called 3242 internally). 3243 3244 -- Function: void mpfr_free_cache2 (mpfr_free_cache_t WAY) 3245 Free various caches and pools used by MPFR internally, as specified 3246 by WAY, which is a set of flags: 3247 ��� those local to the current thread if flag 3248 ���MPFR_FREE_LOCAL_CACHE��� is set; 3249 ��� those shared by all threads if flag ���MPFR_FREE_GLOBAL_CACHE��� 3250 is set. 3251 The other bits of WAY are currently ignored and are reserved for 3252 future use; they should be zero. 3253 3254 Note: ���mpfr_free_cache2 (MPFR_FREE_LOCAL_CACHE | 3255 MPFR_FREE_GLOBAL_CACHE)��� is currently equivalent to 3256 ���mpfr_free_cache()���. 3257 3258 -- Function: void mpfr_free_pool (void) 3259 Free the pools used by MPFR internally. Note: This function is 3260 automatically called after the thread-local caches are freed (with 3261 ���mpfr_free_cache��� or ���mpfr_free_cache2���). 3262 3263 -- Function: int mpfr_mp_memory_cleanup (void) 3264 This function should be called before calling 3265 ���mp_set_memory_functions���. *Note Memory Handling::, for more 3266 information. Zero is returned in case of success, non-zero in case 3267 of error. Errors are currently not possible, but checking the 3268 return value is recommended for future compatibility. 3269 3270 3271File: mpfr.info, Node: Compatibility with MPF, Next: Custom Interface, Prev: Memory Handling Functions, Up: MPFR Interface 3272 32735.15 Compatibility With MPF 3274=========================== 3275 3276A header file ���mpf2mpfr.h��� is included in the distribution of MPFR for 3277compatibility with the GNU MP class MPF. By inserting the following two 3278lines after the ���#include <gmp.h>��� line, 3279 #include <mpfr.h> 3280 #include <mpf2mpfr.h> 3281many programs written for MPF can be compiled directly against MPFR 3282without any changes. All operations are then performed with the default 3283MPFR rounding mode, which can be reset with 3284���mpfr_set_default_rounding_mode���. 3285 3286 Warning! There are some differences. In particular: 3287 ��� The precision is different: MPFR rounds to the exact number of bits 3288 (zeroing trailing bits in the internal representation). Users may 3289 need to increase the precision of their variables. 3290 ��� The exponent range is also different. 3291 ��� The formatted output functions (���gmp_printf���, etc.) will not work 3292 for arguments of arbitrary-precision floating-point type (���mpf_t���, 3293 which ���mpf2mpfr.h��� redefines as ���mpfr_t���). 3294 ��� The output of ���mpf_out_str��� has a format slightly different from 3295 the one of ���mpfr_out_str��� (concerning the position of the 3296 decimal-point character, trailing zeros and the output of the value 3297 0). 3298 3299 -- Function: void mpfr_set_prec_raw (mpfr_t X, mpfr_prec_t PREC) 3300 Reset the precision of X to be *exactly* PREC bits. The only 3301 difference with ���mpfr_set_prec��� is that PREC is assumed to be small 3302 enough so that the significand fits into the current allocated 3303 memory space for X. Otherwise the behavior is undefined. 3304 3305 -- Function: int mpfr_eq (mpfr_t OP1, mpfr_t OP2, unsigned long int 3306 OP3) 3307 Return non-zero if OP1 and OP2 are both non-zero ordinary numbers 3308 with the same exponent and the same first OP3 bits, both zero, or 3309 both infinities of the same sign. Return zero otherwise. This 3310 function is defined for compatibility with MPF, we do not recommend 3311 to use it otherwise. Do not use it either if you want to know 3312 whether two numbers are close to each other; for instance, 1.011111 3313 and 1.100000 are regarded as different for any value of OP3 larger 3314 than 1. 3315 3316 -- Function: void mpfr_reldiff (mpfr_t ROP, mpfr_t OP1, mpfr_t OP2, 3317 mpfr_rnd_t RND) 3318 Compute the relative difference between OP1 and OP2 and store the 3319 result in ROP. This function does not guarantee the correct 3320 rounding on the relative difference; it just computes 3321 |OP1 ��� OP2| / OP1, using the precision of ROP and the rounding mode 3322 RND for all operations. 3323 3324 -- Function: int mpfr_mul_2exp (mpfr_t ROP, mpfr_t OP1, unsigned long 3325 int OP2, mpfr_rnd_t RND) 3326 -- Function: int mpfr_div_2exp (mpfr_t ROP, mpfr_t OP1, unsigned long 3327 int OP2, mpfr_rnd_t RND) 3328 These functions are identical to ���mpfr_mul_2ui��� and ���mpfr_div_2ui��� 3329 respectively. These functions are only kept for compatibility with 3330 MPF, one should prefer ���mpfr_mul_2ui��� and ���mpfr_div_2ui��� otherwise. 3331 3332 3333File: mpfr.info, Node: Custom Interface, Next: Internals, Prev: Compatibility with MPF, Up: MPFR Interface 3334 33355.16 Custom Interface 3336===================== 3337 3338Some applications use a stack to handle the memory and their objects. 3339However, the MPFR memory design is not well suited for such a thing. So 3340that such applications are able to use MPFR, an auxiliary memory 3341interface has been created: the Custom Interface. 3342 3343 The following interface allows one to use MPFR in two ways: 3344 3345 ��� Either directly store a floating-point number as a ���mpfr_t��� on the 3346 stack. 3347 3348 ��� Either store its own representation on the stack and construct a 3349 new temporary ���mpfr_t��� each time it is needed. 3350 3351 Nothing has to be done to destroy the floating-point numbers except 3352garbaging the used memory: all the memory management (allocating, 3353destroying, garbaging) is left to the application. 3354 3355 Each function in this interface is also implemented as a macro for 3356efficiency reasons: for example ���mpfr_custom_init (s, p)��� uses the 3357macro, while ���(mpfr_custom_init) (s, p)��� uses the function. The 3358���mpfr_custom_init_set��� macro is not usable in contexts where an 3359expression is expected, e.g., inside ���for(...)��� or before a comma 3360operator. 3361 3362 Note 1: MPFR functions may still initialize temporary floating-point 3363numbers using ���mpfr_init��� and similar functions. See Custom Allocation 3364(GNU MP). 3365 3366 Note 2: MPFR functions may use the cached functions (���mpfr_const_pi��� 3367for example), even if they are not explicitly called. You have to call 3368���mpfr_free_cache��� each time you garbage the memory iff ���mpfr_init���, 3369through GMP Custom Allocation, allocates its memory on the application 3370stack. 3371 3372 -- Function: size_t mpfr_custom_get_size (mpfr_prec_t PREC) 3373 Return the needed size in bytes to store the significand of a 3374 floating-point number of precision PREC. 3375 3376 -- Function: void mpfr_custom_init (void *SIGNIFICAND, mpfr_prec_t 3377 PREC) 3378 Initialize a significand of precision PREC, where SIGNIFICAND must 3379 be an area of ���mpfr_custom_get_size (prec)��� bytes at least and be 3380 suitably aligned for an array of ���mp_limb_t��� (GMP type, *note 3381 Internals::). 3382 3383 -- Function: void mpfr_custom_init_set (mpfr_t X, int KIND, mpfr_exp_t 3384 EXP, mpfr_prec_t PREC, void *SIGNIFICAND) 3385 Perform a dummy initialization of a ���mpfr_t��� and set it to: 3386 ��� if abs(KIND) = ���MPFR_NAN_KIND���, X is set to NaN; 3387 ��� if abs(KIND) = ���MPFR_INF_KIND���, X is set to the infinity of 3388 the same sign as KIND; 3389 ��� if abs(KIND) = ���MPFR_ZERO_KIND���, X is set to the zero of the 3390 same sign as KIND; 3391 ��� if abs(KIND) = ���MPFR_REGULAR_KIND���, X is set to the regular 3392 number whose sign is the one of KIND, and whose exponent and 3393 significand are given by EXP and SIGNIFICAND. 3394 In all cases, SIGNIFICAND will be used directly for further 3395 computing involving X. This function does not allocate anything. 3396 A floating-point number initialized with this function cannot be 3397 resized using ���mpfr_set_prec��� or ���mpfr_prec_round���, or cleared 3398 using ���mpfr_clear���! The SIGNIFICAND must have been initialized 3399 with ���mpfr_custom_init��� using the same precision PREC. 3400 3401 -- Function: int mpfr_custom_get_kind (mpfr_t X) 3402 Return the current kind of a ���mpfr_t��� as created by 3403 ���mpfr_custom_init_set���. The behavior of this function for any 3404 ���mpfr_t��� not initialized with ���mpfr_custom_init_set��� is undefined. 3405 3406 -- Function: void * mpfr_custom_get_significand (mpfr_t X) 3407 Return a pointer to the significand used by a ���mpfr_t��� initialized 3408 with ���mpfr_custom_init_set���. The behavior of this function for any 3409 ���mpfr_t��� not initialized with ���mpfr_custom_init_set��� is undefined. 3410 3411 -- Function: mpfr_exp_t mpfr_custom_get_exp (mpfr_t X) 3412 Return the exponent of X, assuming that X is a non-zero ordinary 3413 number and the significand is considered in [1/2,1). But if X is 3414 NaN, infinity or zero, contrary to ���mpfr_get_exp��� (where the 3415 behavior is undefined), the return value is here an unspecified, 3416 valid value of the ���mpfr_exp_t��� type. The behavior of this 3417 function for any ���mpfr_t��� not initialized with 3418 ���mpfr_custom_init_set��� is undefined. 3419 3420 -- Function: void mpfr_custom_move (mpfr_t X, void *NEW_POSITION) 3421 Inform MPFR that the significand of X has moved due to a garbage 3422 collect and update its new position to ���new_position���. However, 3423 the application has to move the significand and the ���mpfr_t��� 3424 itself. The behavior of this function for any ���mpfr_t��� not 3425 initialized with ���mpfr_custom_init_set��� is undefined. 3426 3427 3428File: mpfr.info, Node: Internals, Prev: Custom Interface, Up: MPFR Interface 3429 34305.17 Internals 3431============== 3432 3433A ���limb��� means the part of a multi-precision number that fits in a 3434single word. Usually a limb contains 32 or 64 bits. The C data type 3435for a limb is ���mp_limb_t���. 3436 3437 The ���mpfr_t��� type is internally defined as a one-element array of a 3438structure, and ���mpfr_ptr��� is the C data type representing a pointer to 3439this structure. The ���mpfr_t��� type consists of four fields: 3440 3441 ��� The ���_mpfr_prec��� field is used to store the precision of the 3442 variable (in bits); this is not less than ���MPFR_PREC_MIN���. 3443 3444 ��� The ���_mpfr_sign��� field is used to store the sign of the variable. 3445 3446 ��� The ���_mpfr_exp��� field stores the exponent. An exponent of 0 means 3447 a radix point just above the most significant limb. Non-zero 3448 values n are a multiplier 2^n relative to that point. A NaN, an 3449 infinity and a zero are indicated by special values of the exponent 3450 field. 3451 3452 ��� Finally, the ���_mpfr_d��� field is a pointer to the limbs, least 3453 significant limbs stored first. The number of limbs in use is 3454 controlled by ���_mpfr_prec���, namely 3455 ceil(���_mpfr_prec���/���mp_bits_per_limb���). Non-singular (i.e., 3456 different from NaN, infinity or zero) values always have the most 3457 significant bit of the most significant limb set to 1. When the 3458 precision does not correspond to a whole number of limbs, the 3459 excess bits at the low end of the data are zeros. 3460 3461 3462File: mpfr.info, Node: API Compatibility, Next: MPFR and the IEEE 754 Standard, Prev: MPFR Interface, Up: Top 3463 34646 API Compatibility 3465******************* 3466 3467The goal of this section is to describe some API changes that occurred 3468from one version of MPFR to another, and how to write code that can be 3469compiled and run with older MPFR versions. The minimum MPFR version 3470that is considered here is 2.2.0 (released on 20 September 2005). 3471 3472 API changes can only occur between major or minor versions. Thus the 3473patchlevel (the third number in the MPFR version) will be ignored in the 3474following. If a program does not use MPFR internals, changes in the 3475behavior between two versions differing only by the patchlevel should 3476only result from what was regarded as a bug or unspecified behavior. 3477 3478 As a general rule, a program written for some MPFR version should 3479work with later versions, possibly except at a new major version, where 3480some features (described as obsolete for some time) can be removed. In 3481such a case, a failure should occur during compilation or linking. If a 3482result becomes incorrect because of such a change, please look at the 3483various changes below (they are minimal, and most software should be 3484unaffected), at the FAQ and at the MPFR web page for your version (a bug 3485could have been introduced and be already fixed); and if the problem is 3486not mentioned, please send us a bug report (*note Reporting Bugs::). 3487 3488 However, a program written for the current MPFR version (as 3489documented by this manual) may not necessarily work with previous 3490versions of MPFR. This section should help developers to write portable 3491code. 3492 3493 Note: Information given here may be incomplete. API changes are also 3494described in the NEWS file (for each version, instead of being 3495classified like here), together with other changes. 3496 3497* Menu: 3498 3499* Type and Macro Changes:: 3500* Added Functions:: 3501* Changed Functions:: 3502* Removed Functions:: 3503* Other Changes:: 3504 3505 3506File: mpfr.info, Node: Type and Macro Changes, Next: Added Functions, Prev: API Compatibility, Up: API Compatibility 3507 35086.1 Type and Macro Changes 3509========================== 3510 3511The official type for exponent values changed from ���mp_exp_t��� to 3512���mpfr_exp_t��� in MPFR 3.0. The type ���mp_exp_t��� will remain available as 3513it comes from GMP (with a different meaning). These types are currently 3514the same (���mpfr_exp_t��� is defined as ���mp_exp_t��� with ���typedef���), so that 3515programs can still use ���mp_exp_t���; but this may change in the future. 3516Alternatively, using the following code after including ���mpfr.h��� will 3517work with official MPFR versions, as ���mpfr_exp_t��� was never defined in 3518MPFR 2.x: 3519 #if MPFR_VERSION_MAJOR < 3 3520 typedef mp_exp_t mpfr_exp_t; 3521 #endif 3522 3523 The official types for precision values and for rounding modes 3524respectively changed from ���mp_prec_t��� and ���mp_rnd_t��� to ���mpfr_prec_t��� 3525and ���mpfr_rnd_t��� in MPFR 3.0. This change was actually done a long time 3526ago in MPFR, at least since MPFR 2.2.0, with the following code in 3527���mpfr.h���: 3528 #ifndef mp_rnd_t 3529 # define mp_rnd_t mpfr_rnd_t 3530 #endif 3531 #ifndef mp_prec_t 3532 # define mp_prec_t mpfr_prec_t 3533 #endif 3534 This means that it is safe to use the new official types 3535���mpfr_prec_t��� and ���mpfr_rnd_t��� in your programs. The types ���mp_prec_t��� 3536and ���mp_rnd_t��� (defined in MPFR only) may be removed in the future, as 3537the prefix ���mp_��� is reserved by GMP. 3538 3539 The precision type ���mpfr_prec_t��� (���mp_prec_t���) was unsigned before 3540MPFR 3.0; it is now signed. ���MPFR_PREC_MAX��� has not changed, though. 3541Indeed the MPFR code requires that ���MPFR_PREC_MAX��� be representable in 3542the exponent type, which may have the same size as ���mpfr_prec_t��� but has 3543always been signed. The consequence is that valid code that does not 3544assume anything about the signedness of ���mpfr_prec_t��� should work with 3545past and new MPFR versions. This change was useful as the use of 3546unsigned types tends to convert signed values to unsigned ones in 3547expressions due to the usual arithmetic conversions, which can yield 3548incorrect results if a negative value is converted in such a way. 3549Warning! A program assuming (intentionally or not) that ���mpfr_prec_t��� 3550is signed may be affected by this problem when it is built and run 3551against MPFR 2.x. 3552 3553 The rounding modes ���GMP_RNDx��� were renamed to ���MPFR_RNDx��� in 3554MPFR 3.0. However, the old names ���GMP_RNDx��� have been kept for 3555compatibility (this might change in future versions), using: 3556 #define GMP_RNDN MPFR_RNDN 3557 #define GMP_RNDZ MPFR_RNDZ 3558 #define GMP_RNDU MPFR_RNDU 3559 #define GMP_RNDD MPFR_RNDD 3560 The rounding mode ���round away from zero��� (���MPFR_RNDA���) was added in 3561MPFR 3.0 (however, no rounding mode ���GMP_RNDA��� exists). Faithful 3562rounding (���MPFR_RNDF���) was added in MPFR 4.0, but currently, it is 3563partially supported. 3564 3565 The flags-related macros, whose name starts with ���MPFR_FLAGS_���, were 3566added in MPFR 4.0 (for the new functions ���mpfr_flags_clear���, 3567���mpfr_flags_restore���, ���mpfr_flags_set��� and ���mpfr_flags_test���, in 3568particular). 3569 3570 3571File: mpfr.info, Node: Added Functions, Next: Changed Functions, Prev: Type and Macro Changes, Up: API Compatibility 3572 35736.2 Added Functions 3574=================== 3575 3576We give here in alphabetical order the functions (and function-like 3577macros) that were added after MPFR 2.2, and in which MPFR version. 3578 3579 ��� ���mpfr_acospi��� and ���mpfr_acosu��� in MPFR 4.2. 3580 3581 ��� ���mpfr_add_d��� in MPFR 2.4. 3582 3583 ��� ���mpfr_ai��� in MPFR 3.0 (incomplete, experimental). 3584 3585 ��� ���mpfr_asinpi��� and ���mpfr_asinu��� in MPFR 4.2. 3586 3587 ��� ���mpfr_asprintf��� in MPFR 2.4. 3588 3589 ��� ���mpfr_atan2pi��� and ���mpfr_atan2u��� in MPFR 4.2. 3590 3591 ��� ���mpfr_atanpi��� and ���mpfr_atanu��� in MPFR 4.2. 3592 3593 ��� ���mpfr_beta��� in MPFR 4.0 (incomplete, experimental). 3594 3595 ��� ���mpfr_buildopt_decimal_p��� in MPFR 3.0. 3596 3597 ��� ���mpfr_buildopt_float128_p��� in MPFR 4.0. 3598 3599 ��� ���mpfr_buildopt_gmpinternals_p��� in MPFR 3.1. 3600 3601 ��� ���mpfr_buildopt_sharedcache_p��� in MPFR 4.0. 3602 3603 ��� ���mpfr_buildopt_tls_p��� in MPFR 3.0. 3604 3605 ��� ���mpfr_buildopt_tune_case��� in MPFR 3.1. 3606 3607 ��� ���mpfr_clear_divby0��� in MPFR 3.1 (new divide-by-zero exception). 3608 3609 ��� ���mpfr_cmpabs_ui��� in MPFR 4.1. 3610 3611 ��� ���mpfr_compound_si��� in MPFR 4.2. 3612 3613 ��� ���mpfr_copysign��� in MPFR 2.3. Note: MPFR 2.2 had a ���mpfr_copysign��� 3614 function that was available, but not documented, and with a slight 3615 difference in the semantics (when the second input operand is a 3616 NaN). 3617 3618 ��� ���mpfr_cospi��� and ���mpfr_cosu��� in MPFR 4.2. 3619 3620 ��� ���mpfr_custom_get_significand��� in MPFR 3.0. This function was named 3621 ���mpfr_custom_get_mantissa��� in previous versions; 3622 ���mpfr_custom_get_mantissa��� is still available via a macro in 3623 ���mpfr.h���: 3624 #define mpfr_custom_get_mantissa mpfr_custom_get_significand 3625 Thus code that needs to work with both MPFR 2.x and MPFR 3.x should 3626 use ���mpfr_custom_get_mantissa���. 3627 3628 ��� ���mpfr_d_div��� and ���mpfr_d_sub��� in MPFR 2.4. 3629 3630 ��� ���mpfr_digamma��� in MPFR 3.0. 3631 3632 ��� ���mpfr_divby0_p��� in MPFR 3.1 (new divide-by-zero exception). 3633 3634 ��� ���mpfr_div_d��� in MPFR 2.4. 3635 3636 ��� ���mpfr_dot��� in MPFR 4.1 (incomplete, experimental). 3637 3638 ��� ���mpfr_erandom��� in MPFR 4.0. 3639 3640 ��� ���mpfr_exp2m1��� and ���mpfr_exp10m1��� in MPFR 4.2. 3641 3642 ��� ���mpfr_flags_clear���, ���mpfr_flags_restore���, ���mpfr_flags_save���, 3643 ���mpfr_flags_set��� and ���mpfr_flags_test��� in MPFR 4.0. 3644 3645 ��� ���mpfr_fmma��� and ���mpfr_fmms��� in MPFR 4.0. 3646 3647 ��� ���mpfr_fmod��� in MPFR 2.4. 3648 3649 ��� ���mpfr_fmodquo��� in MPFR 4.0. 3650 3651 ��� ���mpfr_fmod_ui��� in MPFR 4.2. 3652 3653 ��� ���mpfr_fms��� in MPFR 2.3. 3654 3655 ��� ���mpfr_fpif_export��� and ���mpfr_fpif_import��� in MPFR 4.0. 3656 3657 ��� ���mpfr_fprintf��� in MPFR 2.4. 3658 3659 ��� ���mpfr_free_cache2��� in MPFR 4.0. 3660 3661 ��� ���mpfr_free_pool��� in MPFR 4.0. 3662 3663 ��� ���mpfr_frexp��� in MPFR 3.1. 3664 3665 ��� ���mpfr_gamma_inc��� in MPFR 4.0. 3666 3667 ��� ���mpfr_get_decimal128��� in MPFR 4.1. 3668 3669 ��� ���mpfr_get_float128��� in MPFR 4.0 if configured with 3670 ���--enable-float128���. 3671 3672 ��� ���mpfr_get_flt��� in MPFR 3.0. 3673 3674 ��� ���mpfr_get_patches��� in MPFR 2.3. 3675 3676 ��� ���mpfr_get_q��� in MPFR 4.0. 3677 3678 ��� ���mpfr_get_str_ndigits��� in MPFR 4.1. 3679 3680 ��� ���mpfr_get_z_2exp��� in MPFR 3.0. This function was named 3681 ���mpfr_get_z_exp��� in previous versions; ���mpfr_get_z_exp��� is still 3682 available via a macro in ���mpfr.h���: 3683 #define mpfr_get_z_exp mpfr_get_z_2exp 3684 Thus code that needs to work with both MPFR 2.x and MPFR 3.x should 3685 use ���mpfr_get_z_exp���. 3686 3687 ��� ���mpfr_grandom��� in MPFR 3.1. 3688 3689 ��� ���mpfr_j0���, ���mpfr_j1��� and ���mpfr_jn��� in MPFR 2.3. 3690 3691 ��� ���mpfr_log2p1��� and ���mpfr_log10p1��� in MPFR 4.2. 3692 3693 ��� ���mpfr_lgamma��� in MPFR 2.3. 3694 3695 ��� ���mpfr_li2��� in MPFR 2.4. 3696 3697 ��� ���mpfr_log_ui��� in MPFR 4.0. 3698 3699 ��� ���mpfr_min_prec��� in MPFR 3.0. 3700 3701 ��� ���mpfr_modf��� in MPFR 2.4. 3702 3703 ��� ���mpfr_mp_memory_cleanup��� in MPFR 4.0. 3704 3705 ��� ���mpfr_mul_d��� in MPFR 2.4. 3706 3707 ��� ���mpfr_nrandom��� in MPFR 4.0. 3708 3709 ��� ���mpfr_powr���, ���mpfr_pown���, ���mpfr_pow_sj��� and ���mpfr_pow_uj��� in 3710 MPFR 4.2. 3711 3712 ��� ���mpfr_printf��� in MPFR 2.4. 3713 3714 ��� ���mpfr_rec_sqrt��� in MPFR 2.4. 3715 3716 ��� ���mpfr_regular_p��� in MPFR 3.0. 3717 3718 ��� ���mpfr_remainder��� and ���mpfr_remquo��� in MPFR 2.3. 3719 3720 ��� ���mpfr_rint_roundeven��� and ���mpfr_roundeven��� in MPFR 4.0. 3721 3722 ��� ���mpfr_round_nearest_away��� in MPFR 4.0. 3723 3724 ��� ���mpfr_rootn_si��� in MPFR 4.2. 3725 3726 ��� ���mpfr_rootn_ui��� in MPFR 4.0. 3727 3728 ��� ���mpfr_set_decimal128��� in MPFR 4.1. 3729 3730 ��� ���mpfr_set_divby0��� in MPFR 3.1 (new divide-by-zero exception). 3731 3732 ��� ���mpfr_set_float128��� in MPFR 4.0 if configured with 3733 ���--enable-float128���. 3734 3735 ��� ���mpfr_set_flt��� in MPFR 3.0. 3736 3737 ��� ���mpfr_set_z_2exp��� in MPFR 3.0. 3738 3739 ��� ���mpfr_set_zero��� in MPFR 3.0. 3740 3741 ��� ���mpfr_setsign��� in MPFR 2.3. 3742 3743 ��� ���mpfr_signbit��� in MPFR 2.3. 3744 3745 ��� ���mpfr_sinh_cosh��� in MPFR 2.4. 3746 3747 ��� ���mpfr_sinpi��� and ���mpfr_sinu��� in MPFR 4.2. 3748 3749 ��� ���mpfr_snprintf��� and ���mpfr_sprintf��� in MPFR 2.4. 3750 3751 ��� ���mpfr_sub_d��� in MPFR 2.4. 3752 3753 ��� ���mpfr_tanpi��� and ���mpfr_tanu��� in MPFR 4.2. 3754 3755 ��� ���mpfr_total_order_p��� in MPFR 4.1. 3756 3757 ��� ���mpfr_urandom��� in MPFR 3.0. 3758 3759 ��� ���mpfr_vasprintf���, ���mpfr_vfprintf���, ���mpfr_vprintf���, ���mpfr_vsprintf��� 3760 and ���mpfr_vsnprintf��� in MPFR 2.4. 3761 3762 ��� ���mpfr_y0���, ���mpfr_y1��� and ���mpfr_yn��� in MPFR 2.3. 3763 3764 ��� ���mpfr_z_sub��� in MPFR 3.1. 3765 3766 3767File: mpfr.info, Node: Changed Functions, Next: Removed Functions, Prev: Added Functions, Up: API Compatibility 3768 37696.3 Changed Functions 3770===================== 3771 3772The following functions and function-like macros have changed after 3773MPFR 2.2. Changes can affect the behavior of code written for some MPFR 3774version when built and run against another MPFR version (older or 3775newer), as described below. 3776 3777 ��� The formatted output functions (���mpfr_printf���, etc.) have slightly 3778 changed in MPFR 4.1 in the case where the precision field is empty: 3779 trailing zeros were not output with the conversion specifier ���e��� / 3780 ���E��� (the chosen precision was not fully specified and it depended 3781 on the input value), and also on the value zero with the conversion 3782 specifiers ���f��� / ���F��� / ���g��� / ���G��� (this could partly be regarded as 3783 a bug); they are now kept in a way similar to the formatted output 3784 functions from C. Moreover, the case where the precision consists 3785 only of a period has been fixed in MPFR 4.2 to be like ���.0��� as 3786 specified in the ISO C standard (it previously behaved as a missing 3787 precision). 3788 3789 ��� ���mpfr_abs���, ���mpfr_neg��� and ���mpfr_set��� changed in MPFR 4.0. In 3790 previous MPFR versions, the sign bit of a NaN was unspecified; 3791 however, in practice, it was set as now specified except for 3792 ���mpfr_neg��� with a reused argument: ���mpfr_neg(x,x,rnd)���. 3793 3794 ��� ���mpfr_check_range��� changed in MPFR 2.3.2 and MPFR 2.4. If the 3795 value is an inexact infinity, the overflow flag is now set (in case 3796 it was lost), while it was previously left unchanged. This is 3797 really what is expected in practice (and what the MPFR code was 3798 expecting), so that the previous behavior was regarded as a bug. 3799 Hence the change in MPFR 2.3.2. 3800 3801 ��� ���mpfr_eint��� changed in MPFR 4.0. This function now returns the 3802 value of the E1/eint1 function for negative argument (before 3803 MPFR 4.0, it was returning NaN). 3804 3805 ��� ���mpfr_get_f��� changed in MPFR 3.0. This function was returning 3806 zero, except for NaN and Inf, which do not exist in MPF. The 3807 _erange_ flag is now set in these cases, and ���mpfr_get_f��� now 3808 returns the usual ternary value. 3809 3810 ��� ���mpfr_get_si���, ���mpfr_get_sj���, ���mpfr_get_ui��� and ���mpfr_get_uj��� 3811 changed in MPFR 3.0. In previous MPFR versions, the cases where 3812 the _erange_ flag is set were unspecified. 3813 3814 ��� ���mpfr_get_str��� changed in MPFR 4.0. This function now sets the NaN 3815 flag on NaN input (to follow the usual MPFR rules on NaN and 3816 IEEE 754 recommendations on string conversions from 3817 Subclause 5.12.1) and sets the inexact flag when the conversion is 3818 inexact. 3819 3820 ��� ���mpfr_get_z��� changed in MPFR 3.0. The return type was ���void���; it 3821 is now ���int���, and the usual ternary value is returned. Thus 3822 programs that need to work with both MPFR 2.x and 3.x must not use 3823 the return value. Even in this case, C code using ���mpfr_get_z��� as 3824 the second or third term of a conditional operator may also be 3825 affected. For instance, the following is correct with MPFR 3.0, 3826 but not with MPFR 2.x: 3827 bool ? mpfr_get_z(...) : mpfr_add(...); 3828 On the other hand, the following is correct with MPFR 2.x, but not 3829 with MPFR 3.0: 3830 bool ? mpfr_get_z(...) : (void) mpfr_add(...); 3831 Portable code should cast ���mpfr_get_z(...)��� to ���void��� to use the 3832 type ���void��� for both terms of the conditional operator, as in: 3833 bool ? (void) mpfr_get_z(...) : (void) mpfr_add(...); 3834 Alternatively, ���if ... else��� can be used instead of the conditional 3835 operator. 3836 3837 Moreover the cases where the _erange_ flag is set were unspecified 3838 in MPFR 2.x. 3839 3840 ��� ���mpfr_get_z_exp��� changed in MPFR 3.0. In previous MPFR versions, 3841 the cases where the _erange_ flag is set were unspecified. Note: 3842 this function has been renamed to ���mpfr_get_z_2exp��� in MPFR 3.0, 3843 but ���mpfr_get_z_exp��� is still available for compatibility reasons. 3844 3845 ��� ���mpfr_out_str��� changed in MPFR 4.1. The argument BASE can now be 3846 negative (from ���2 to ���36), in order to follow ���mpfr_get_str��� and 3847 GMP���s ���mpf_out_str��� functions. 3848 3849 ��� ���mpfr_set_exp��� changed in MPFR 4.0. Before MPFR 4.0, the exponent 3850 was set whatever the contents of the MPFR object in argument. In 3851 practice, this could be useful as a low-level function when the 3852 MPFR number was being constructed by setting the fields of its 3853 internal structure, but the API does not provide a way to do this 3854 except by using internals. Thus, for the API, this behavior was 3855 useless and could quickly lead to undefined behavior due to the 3856 fact that the generated value could have an invalid format if the 3857 MPFR object contained a special value (NaN, infinity or zero). 3858 3859 ��� ���mpfr_strtofr��� changed in MPFR 2.3.1 and MPFR 2.4. This was 3860 actually a bug fix since the code and the documentation did not 3861 match. But both were changed in order to have a more consistent 3862 and useful behavior. The main changes in the code are as follows. 3863 The binary exponent is now accepted even without the ���0b��� or ���0x��� 3864 prefix. Data corresponding to NaN can now have an optional sign 3865 (such data were previously invalid). 3866 3867 ��� ���mpfr_strtofr��� changed in MPFR 3.0. This function now accepts 3868 bases from 37 to 62 (no changes for the other bases). Note: if an 3869 unsupported base is provided to this function, the behavior is 3870 undefined; more precisely, in MPFR 2.3.1 and later, providing an 3871 unsupported base yields an assertion failure (this behavior may 3872 change in the future). 3873 3874 ��� ���mpfr_subnormalize��� changed in MPFR 3.1. This was actually 3875 regarded as a bug fix. The ���mpfr_subnormalize��� implementation up 3876 to MPFR 3.0.0 did not change the flags. In particular, it did not 3877 follow the generic rule concerning the inexact flag (and no special 3878 behavior was specified). The case of the underflow flag was more a 3879 lack of specification. 3880 3881 ��� ���mpfr_sum��� changed in MPFR 4.0. The ���mpfr_sum��� function has 3882 completely been rewritten for MPFR 4.0, with an update of the 3883 specification: the sign of an exact zero result is now specified, 3884 and the return value is now the usual ternary value. The old 3885 ���mpfr_sum��� implementation could also take all the memory and crash 3886 on inputs of very different magnitude. 3887 3888 ��� ���mpfr_urandom��� and ���mpfr_urandomb��� changed in MPFR 3.1. Their 3889 behavior no longer depends on the platform (assuming this is also 3890 true for GMP���s random generator, which is not the case between GMP 3891 4.1 and 4.2 if ���gmp_randinit_default��� is used). As a consequence, 3892 the returned values can be different between MPFR 3.1 and previous 3893 MPFR versions. Note: as the reproducibility of these functions was 3894 not specified before MPFR 3.1, the MPFR 3.1 behavior is _not_ 3895 regarded as backward incompatible with previous versions. 3896 3897 ��� ���mpfr_urandom��� changed in MPFR 4.0. The next random state no 3898 longer depends on the current exponent range and the rounding mode. 3899 The exceptions due to the rounding of the random number are now 3900 correctly generated, following the uniform distribution. As a 3901 consequence, the returned values can be different between MPFR 4.0 3902 and previous MPFR versions. 3903 3904 ��� Up to MPFR 4.1.0, some macros of the *note Custom Interface:: had 3905 undocumented limitations. In particular, their arguments may be 3906 evaluated multiple times or none. 3907 3908 3909File: mpfr.info, Node: Removed Functions, Next: Other Changes, Prev: Changed Functions, Up: API Compatibility 3910 39116.4 Removed Functions 3912===================== 3913 3914Functions ���mpfr_random��� and ���mpfr_random2��� have been removed in MPFR 3.0 3915(this only affects old code built against MPFR 3.0 or later). (The 3916function ���mpfr_random��� had been deprecated since at least MPFR 2.2.0, 3917and ���mpfr_random2��� since MPFR 2.4.0.) 3918 3919 Macros ���mpfr_add_one_ulp��� and ���mpfr_sub_one_ulp��� have been removed in 3920MPFR 4.0. They were no longer documented since MPFR 2.1.0 and were 3921announced as deprecated since MPFR 3.1.0. 3922 3923 Function ���mpfr_grandom��� is marked as deprecated in MPFR 4.0. It will 3924be removed in a future release. 3925 3926 3927File: mpfr.info, Node: Other Changes, Prev: Removed Functions, Up: API Compatibility 3928 39296.5 Other Changes 3930================= 3931 3932For users of a C++ compiler, the way how the availability of ���intmax_t��� 3933is detected has changed in MPFR 3.0. In MPFR 2.x, if a macro ���INTMAX_C��� 3934or ���UINTMAX_C��� was defined (e.g. when the ���__STDC_CONSTANT_MACROS��� 3935macro had been defined before ���<stdint.h>��� or ���<inttypes.h>��� has been 3936included), ���intmax_t��� was assumed to be defined. However, this was not 3937always the case (more precisely, ���intmax_t��� can be defined only in the 3938namespace ���std���, as with Boost), so that compilations could fail. Thus 3939the check for ���INTMAX_C��� or ���UINTMAX_C��� is now disabled for C++ 3940compilers, with the following consequences: 3941 3942 ��� Programs written for MPFR 2.x that need ���intmax_t��� may no longer be 3943 compiled against MPFR 3.0: a ���#define MPFR_USE_INTMAX_T��� may be 3944 necessary before ���mpfr.h��� is included. 3945 3946 ��� The compilation of programs that work with MPFR 3.0 may fail with 3947 MPFR 2.x due to the problem described above. Workarounds are 3948 possible, such as defining ���intmax_t��� and ���uintmax_t��� in the global 3949 namespace, though this is not clean. 3950 3951 The divide-by-zero exception is new in MPFR 3.1. However, it should 3952not introduce incompatible changes for programs that strictly follow the 3953MPFR API since the exception can only be seen via new functions. 3954 3955 As of MPFR 3.1, the ���mpfr.h��� header can be included several times, 3956while still supporting optional functions (*note Headers and 3957Libraries::). 3958 3959 The way memory is allocated by MPFR should be regarded as 3960well-specified only as of MPFR 4.0. 3961 3962 3963File: mpfr.info, Node: MPFR and the IEEE 754 Standard, Next: Contributors, Prev: API Compatibility, Up: Top 3964 39657 MPFR and the IEEE 754 Standard 3966******************************** 3967 3968This section describes differences between MPFR and the IEEE 754 3969standard, and behaviors that are not specified yet in IEEE 754. 3970 3971 The MPFR numbers do not include subnormals. The reason is that 3972subnormals are less useful than in IEEE 754 as the default exponent 3973range in MPFR is large and they would have made the implementation more 3974complex. However, subnormals can be emulated using ���mpfr_subnormalize���. 3975 3976 MPFR has a single NaN. The behavior is similar either to a signaling 3977NaN or to a quiet NaN, depending on the context. For any function 3978returning a NaN (either produced or propagated), the NaN flag is set, 3979while in IEEE 754, some operations are quiet (even on a signaling NaN). 3980 3981 The ���mpfr_rec_sqrt��� function differs from IEEE 754 on ���0, where it 3982gives +Inf (like for +0), following the usual limit rules, instead of 3983���Inf. 3984 3985 The ���mpfr_root��� function predates IEEE 754-2008, where rootn was 3986introduced, and behaves differently from the IEEE 754 rootn operation. 3987It is deprecated and ���mpfr_rootn_ui��� should be used instead. 3988 3989 Operations with an unsigned zero: For functions taking an argument of 3990integer or rational type, a zero of such a type is unsigned unlike the 3991floating-point zero (this includes the zero of type ���unsigned long���, 3992which is a mathematical, exact zero, as opposed to a floating-point 3993zero, which may come from an underflow and whose sign would correspond 3994to the sign of the real non-zero value). Unless documented otherwise, 3995this zero is regarded as +0, as if it were first converted to a MPFR 3996number with ���mpfr_set_ui��� or ���mpfr_set_si��� (thus the result may not 3997agree with the usual limit rules applied to a mathematical zero). This 3998is not the case of addition and subtraction (���mpfr_add_ui���, etc.), but 3999for these functions, only the sign of a zero result would be affected, 4000with +0 and ���0 considered equal. Such operations are currently out of 4001the scope of the IEEE 754 standard, and at the time of specification in 4002MPFR, the Floating-Point Working Group in charge of the revision of 4003IEEE 754 did not want to discuss issues with non-floating-point types in 4004general. 4005 4006 Note also that some obvious differences may come from the fact that 4007in MPFR, each variable has its own precision. For instance, a 4008subtraction of two numbers of the same sign may yield an overflow; idem 4009for a call to ���mpfr_set���, ���mpfr_neg��� or ���mpfr_abs���, if the destination 4010variable has a smaller precision. 4011 4012 4013File: mpfr.info, Node: Contributors, Next: References, Prev: MPFR and the IEEE 754 Standard, Up: Top 4014 4015Contributors 4016************ 4017 4018The main developers of MPFR are Guillaume Hanrot, Vincent Lef��vre, 4019Patrick P��lissier, Philippe Th��veny and Paul Zimmermann. 4020 4021 Sylvie Boldo from ENS-Lyon, France, contributed the functions 4022���mpfr_agm��� and ���mpfr_log���. Sylvain Chevillard contributed the ���mpfr_ai��� 4023function. David Daney contributed the hyperbolic and inverse hyperbolic 4024functions, the base-2 exponential, and the factorial function. Alain 4025Delplanque contributed the new version of the ���mpfr_get_str��� function. 4026Mathieu Dutour contributed the functions ���mpfr_acos���, ���mpfr_asin��� and 4027���mpfr_atan���, and a previous version of ���mpfr_gamma���. Laurent Fousse 4028contributed the original version of the ���mpfr_sum��� function (used up to 4029MPFR 3.1). Emmanuel Jeandel, from ENS-Lyon too, contributed the generic 4030hypergeometric code, as well as the internal function ���mpfr_exp3���, a 4031first implementation of the sine and cosine, and improved versions of 4032���mpfr_const_log2��� and ���mpfr_const_pi���. Ludovic Meunier helped in the 4033design of the ���mpfr_erf��� code. Jean-Luc R��my contributed the 4034���mpfr_zeta��� code. Fabrice Rouillier contributed the ���mpfr_xxx_z��� and 4035���mpfr_xxx_q��� functions, and helped to the Microsoft Windows porting. 4036Damien Stehl�� contributed the ���mpfr_get_ld_2exp��� function. Charles 4037Karney contributed the ���mpfr_nrandom��� and ���mpfr_erandom��� functions. 4038 4039 We would like to thank Jean-Michel Muller and Joris van der Hoeven 4040for very fruitful discussions at the beginning of that project, Torbj��rn 4041Granlund and Kevin Ryde for their help about design issues, and Nathalie 4042Revol for her careful reading of a previous version of this 4043documentation. In particular Kevin Ryde did a tremendous job for the 4044portability of MPFR in 2002-2004. 4045 4046 The development of the MPFR library would not have been possible 4047without the continuous support of INRIA, and of the LORIA (Nancy, 4048France) and LIP (Lyon, France) laboratories. In particular the main 4049authors were or are members of the PolKA, Spaces, Cacao, Caramel and 4050Caramba project-teams at LORIA and of the Ar��naire and AriC 4051project-teams at LIP. This project was started during the Fiable 4052(reliable in French) action supported by INRIA, and continued during the 4053AOC action. The development of MPFR was also supported by a grant 4054(202F0659 00 MPN 121) from the Conseil R��gional de Lorraine in 2002, 4055from INRIA by an "associate engineer" grant (2003-2005), an "op��ration 4056de d��veloppement logiciel" grant (2007-2009), and the post-doctoral 4057grant of Sylvain Chevillard in 2009-2010. The MPFR-MPC workshop in June 40582012 was partly supported by the ERC grant ANTICS of Andreas Enge. The 4059MPFR-MPC workshop in January 2013 was partly supported by the ERC grant 4060ANTICS, the GDR IM and the Caramel project-team, during which Micka��l 4061Gastineau contributed the MPFRbench program, Fredrik Johansson a faster 4062version of ���mpfr_const_euler���, and Jianyang Pan a formally proven 4063version of the ���mpfr_add1sp1��� internal routine. 4064 4065 4066File: mpfr.info, Node: References, Next: GNU Free Documentation License, Prev: Contributors, Up: Top 4067 4068References 4069********** 4070 4071 ��� Richard Brent and Paul Zimmermann, "Modern Computer Arithmetic", 4072 Cambridge University Press, Cambridge Monographs on Applied and 4073 Computational Mathematics, Number 18, 2010. Electronic version 4074 freely available at 4075 <https://members.loria.fr/PZimmermann/mca/pub226.html>. 4076 4077 ��� Laurent Fousse, Guillaume Hanrot, Vincent Lef��vre, Patrick 4078 P��lissier and Paul Zimmermann, "MPFR: A Multiple-Precision Binary 4079 Floating-Point Library With Correct Rounding", ACM Transactions on 4080 Mathematical Software, volume 33, issue 2, article 13, 15 pages, 4081 2007, <https://doi.org/10.1145/1236463.1236468>. 4082 4083 ��� Torbj��rn Granlund, "GNU MP: The GNU Multiple Precision Arithmetic 4084 Library", version 6.1.2, 2016, <https://gmplib.org/>. 4085 4086 ��� IEEE standard for binary floating-point arithmetic, Technical 4087 Report ANSI-IEEE Standard 754-1985, New York, 1985. Approved March 4088 21, 1985: IEEE Standards Board; approved July 26, 1985: American 4089 National Standards Institute, 18 pages. 4090 4091 ��� IEEE Standard for Floating-Point Arithmetic, IEEE Standard 4092 754-2008, 2008. Revision of IEEE Standard 754-1985, approved June 4093 12, 2008: IEEE-SA Standards Board, 70 pages. 4094 4095 ��� IEEE Standard for Floating-Point Arithmetic, IEEE Standard 4096 754-2019, 2019. Revision of IEEE Standard 754-2008, approved June 4097 13, 2019: IEEE-SA Standards Board, 84 pages. 4098 4099 ��� Donald E. Knuth, "The Art of Computer Programming", vol 2, 4100 "Seminumerical Algorithms", 2nd edition, Addison-Wesley, 1981. 4101 4102 ��� Jean-Michel Muller, "Elementary Functions, Algorithms and 4103 Implementation", Birkh��user, Boston, 3rd edition, 2016. 4104 4105 ��� Jean-Michel Muller, Nicolas Brisebarre, Florent de Dinechin, 4106 Claude-Pierre Jeannerod, Vincent Lef��vre, Guillaume Melquiond, 4107 Nathalie Revol, Damien Stehl�� and Serge Torr��s, "Handbook of 4108 Floating-Point Arithmetic", Birkh��user, Boston, 2009. 4109 4110 4111File: mpfr.info, Node: GNU Free Documentation License, Next: Concept Index, Prev: References, Up: Top 4112 4113Appendix A GNU Free Documentation License 4114***************************************** 4115 4116 Version 1.2, November 2002 4117 4118 Copyright �� 2000,2001,2002 Free Software Foundation, Inc. 4119 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 4120 4121 Everyone is permitted to copy and distribute verbatim copies 4122 of this license document, but changing it is not allowed. 4123 4124 0. PREAMBLE 4125 4126 The purpose of this License is to make a manual, textbook, or other 4127 functional and useful document ���free��� in the sense of freedom: to 4128 assure everyone the effective freedom to copy and redistribute it, 4129 with or without modifying it, either commercially or 4130 noncommercially. Secondarily, this License preserves for the 4131 author and publisher a way to get credit for their work, while not 4132 being considered responsible for modifications made by others. 4133 4134 This License is a kind of ���copyleft���, which means that derivative 4135 works of the document must themselves be free in the same sense. 4136 It complements the GNU General Public License, which is a copyleft 4137 license designed for free software. 4138 4139 We have designed this License in order to use it for manuals for 4140 free software, because free software needs free documentation: a 4141 free program should come with manuals providing the same freedoms 4142 that the software does. But this License is not limited to 4143 software manuals; it can be used for any textual work, regardless 4144 of subject matter or whether it is published as a printed book. We 4145 recommend this License principally for works whose purpose is 4146 instruction or reference. 4147 4148 1. APPLICABILITY AND DEFINITIONS 4149 4150 This License applies to any manual or other work, in any medium, 4151 that contains a notice placed by the copyright holder saying it can 4152 be distributed under the terms of this License. Such a notice 4153 grants a world-wide, royalty-free license, unlimited in duration, 4154 to use that work under the conditions stated herein. The 4155 ���Document���, below, refers to any such manual or work. Any member 4156 of the public is a licensee, and is addressed as ���you���. You accept 4157 the license if you copy, modify or distribute the work in a way 4158 requiring permission under copyright law. 4159 4160 A ���Modified Version��� of the Document means any work containing the 4161 Document or a portion of it, either copied verbatim, or with 4162 modifications and/or translated into another language. 4163 4164 A ���Secondary Section��� is a named appendix or a front-matter section 4165 of the Document that deals exclusively with the relationship of the 4166 publishers or authors of the Document to the Document���s overall 4167 subject (or to related matters) and contains nothing that could 4168 fall directly within that overall subject. (Thus, if the Document 4169 is in part a textbook of mathematics, a Secondary Section may not 4170 explain any mathematics.) The relationship could be a matter of 4171 historical connection with the subject or with related matters, or 4172 of legal, commercial, philosophical, ethical or political position 4173 regarding them. 4174 4175 The ���Invariant Sections��� are certain Secondary Sections whose 4176 titles are designated, as being those of Invariant Sections, in the 4177 notice that says that the Document is released under this License. 4178 If a section does not fit the above definition of Secondary then it 4179 is not allowed to be designated as Invariant. The Document may 4180 contain zero Invariant Sections. If the Document does not identify 4181 any Invariant Sections then there are none. 4182 4183 The ���Cover Texts��� are certain short passages of text that are 4184 listed, as Front-Cover Texts or Back-Cover Texts, in the notice 4185 that says that the Document is released under this License. A 4186 Front-Cover Text may be at most 5 words, and a Back-Cover Text may 4187 be at most 25 words. 4188 4189 A ���Transparent��� copy of the Document means a machine-readable copy, 4190 represented in a format whose specification is available to the 4191 general public, that is suitable for revising the document 4192 straightforwardly with generic text editors or (for images composed 4193 of pixels) generic paint programs or (for drawings) some widely 4194 available drawing editor, and that is suitable for input to text 4195 formatters or for automatic translation to a variety of formats 4196 suitable for input to text formatters. A copy made in an otherwise 4197 Transparent file format whose markup, or absence of markup, has 4198 been arranged to thwart or discourage subsequent modification by 4199 readers is not Transparent. An image format is not Transparent if 4200 used for any substantial amount of text. A copy that is not 4201 ���Transparent��� is called ���Opaque���. 4202 4203 Examples of suitable formats for Transparent copies include plain 4204 ASCII without markup, Texinfo input format, LaTeX input format, 4205 SGML or XML using a publicly available DTD, and standard-conforming 4206 simple HTML, PostScript or PDF designed for human modification. 4207 Examples of transparent image formats include PNG, XCF and JPG. 4208 Opaque formats include proprietary formats that can be read and 4209 edited only by proprietary word processors, SGML or XML for which 4210 the DTD and/or processing tools are not generally available, and 4211 the machine-generated HTML, PostScript or PDF produced by some word 4212 processors for output purposes only. 4213 4214 The ���Title Page��� means, for a printed book, the title page itself, 4215 plus such following pages as are needed to hold, legibly, the 4216 material this License requires to appear in the title page. For 4217 works in formats which do not have any title page as such, ���Title 4218 Page��� means the text near the most prominent appearance of the 4219 work���s title, preceding the beginning of the body of the text. 4220 4221 A section ���Entitled XYZ��� means a named subunit of the Document 4222 whose title either is precisely XYZ or contains XYZ in parentheses 4223 following text that translates XYZ in another language. (Here XYZ 4224 stands for a specific section name mentioned below, such as 4225 ���Acknowledgements���, ���Dedications���, ���Endorsements���, or ���History���.) 4226 To ���Preserve the Title��� of such a section when you modify the 4227 Document means that it remains a section ���Entitled XYZ��� according 4228 to this definition. 4229 4230 The Document may include Warranty Disclaimers next to the notice 4231 which states that this License applies to the Document. These 4232 Warranty Disclaimers are considered to be included by reference in 4233 this License, but only as regards disclaiming warranties: any other 4234 implication that these Warranty Disclaimers may have is void and 4235 has no effect on the meaning of this License. 4236 4237 2. VERBATIM COPYING 4238 4239 You may copy and distribute the Document in any medium, either 4240 commercially or noncommercially, provided that this License, the 4241 copyright notices, and the license notice saying this License 4242 applies to the Document are reproduced in all copies, and that you 4243 add no other conditions whatsoever to those of this License. You 4244 may not use technical measures to obstruct or control the reading 4245 or further copying of the copies you make or distribute. However, 4246 you may accept compensation in exchange for copies. If you 4247 distribute a large enough number of copies you must also follow the 4248 conditions in section 3. 4249 4250 You may also lend copies, under the same conditions stated above, 4251 and you may publicly display copies. 4252 4253 3. COPYING IN QUANTITY 4254 4255 If you publish printed copies (or copies in media that commonly 4256 have printed covers) of the Document, numbering more than 100, and 4257 the Document���s license notice requires Cover Texts, you must 4258 enclose the copies in covers that carry, clearly and legibly, all 4259 these Cover Texts: Front-Cover Texts on the front cover, and 4260 Back-Cover Texts on the back cover. Both covers must also clearly 4261 and legibly identify you as the publisher of these copies. The 4262 front cover must present the full title with all words of the title 4263 equally prominent and visible. You may add other material on the 4264 covers in addition. Copying with changes limited to the covers, as 4265 long as they preserve the title of the Document and satisfy these 4266 conditions, can be treated as verbatim copying in other respects. 4267 4268 If the required texts for either cover are too voluminous to fit 4269 legibly, you should put the first ones listed (as many as fit 4270 reasonably) on the actual cover, and continue the rest onto 4271 adjacent pages. 4272 4273 If you publish or distribute Opaque copies of the Document 4274 numbering more than 100, you must either include a machine-readable 4275 Transparent copy along with each Opaque copy, or state in or with 4276 each Opaque copy a computer-network location from which the general 4277 network-using public has access to download using public-standard 4278 network protocols a complete Transparent copy of the Document, free 4279 of added material. If you use the latter option, you must take 4280 reasonably prudent steps, when you begin distribution of Opaque 4281 copies in quantity, to ensure that this Transparent copy will 4282 remain thus accessible at the stated location until at least one 4283 year after the last time you distribute an Opaque copy (directly or 4284 through your agents or retailers) of that edition to the public. 4285 4286 It is requested, but not required, that you contact the authors of 4287 the Document well before redistributing any large number of copies, 4288 to give them a chance to provide you with an updated version of the 4289 Document. 4290 4291 4. MODIFICATIONS 4292 4293 You may copy and distribute a Modified Version of the Document 4294 under the conditions of sections 2 and 3 above, provided that you 4295 release the Modified Version under precisely this License, with the 4296 Modified Version filling the role of the Document, thus licensing 4297 distribution and modification of the Modified Version to whoever 4298 possesses a copy of it. In addition, you must do these things in 4299 the Modified Version: 4300 4301 A. Use in the Title Page (and on the covers, if any) a title 4302 distinct from that of the Document, and from those of previous 4303 versions (which should, if there were any, be listed in the 4304 History section of the Document). You may use the same title 4305 as a previous version if the original publisher of that 4306 version gives permission. 4307 4308 B. List on the Title Page, as authors, one or more persons or 4309 entities responsible for authorship of the modifications in 4310 the Modified Version, together with at least five of the 4311 principal authors of the Document (all of its principal 4312 authors, if it has fewer than five), unless they release you 4313 from this requirement. 4314 4315 C. State on the Title page the name of the publisher of the 4316 Modified Version, as the publisher. 4317 4318 D. Preserve all the copyright notices of the Document. 4319 4320 E. Add an appropriate copyright notice for your modifications 4321 adjacent to the other copyright notices. 4322 4323 F. Include, immediately after the copyright notices, a license 4324 notice giving the public permission to use the Modified 4325 Version under the terms of this License, in the form shown in 4326 the Addendum below. 4327 4328 G. Preserve in that license notice the full lists of Invariant 4329 Sections and required Cover Texts given in the Document���s 4330 license notice. 4331 4332 H. Include an unaltered copy of this License. 4333 4334 I. Preserve the section Entitled ���History���, Preserve its Title, 4335 and add to it an item stating at least the title, year, new 4336 authors, and publisher of the Modified Version as given on the 4337 Title Page. If there is no section Entitled ���History��� in the 4338 Document, create one stating the title, year, authors, and 4339 publisher of the Document as given on its Title Page, then add 4340 an item describing the Modified Version as stated in the 4341 previous sentence. 4342 4343 J. Preserve the network location, if any, given in the Document 4344 for public access to a Transparent copy of the Document, and 4345 likewise the network locations given in the Document for 4346 previous versions it was based on. These may be placed in the 4347 ���History��� section. You may omit a network location for a work 4348 that was published at least four years before the Document 4349 itself, or if the original publisher of the version it refers 4350 to gives permission. 4351 4352 K. For any section Entitled ���Acknowledgements��� or ���Dedications���, 4353 Preserve the Title of the section, and preserve in the section 4354 all the substance and tone of each of the contributor 4355 acknowledgements and/or dedications given therein. 4356 4357 L. Preserve all the Invariant Sections of the Document, unaltered 4358 in their text and in their titles. Section numbers or the 4359 equivalent are not considered part of the section titles. 4360 4361 M. Delete any section Entitled ���Endorsements���. Such a section 4362 may not be included in the Modified Version. 4363 4364 N. Do not retitle any existing section to be Entitled 4365 ���Endorsements��� or to conflict in title with any Invariant 4366 Section. 4367 4368 O. Preserve any Warranty Disclaimers. 4369 4370 If the Modified Version includes new front-matter sections or 4371 appendices that qualify as Secondary Sections and contain no 4372 material copied from the Document, you may at your option designate 4373 some or all of these sections as invariant. To do this, add their 4374 titles to the list of Invariant Sections in the Modified Version���s 4375 license notice. These titles must be distinct from any other 4376 section titles. 4377 4378 You may add a section Entitled ���Endorsements���, provided it contains 4379 nothing but endorsements of your Modified Version by various 4380 parties���for example, statements of peer review or that the text has 4381 been approved by an organization as the authoritative definition of 4382 a standard. 4383 4384 You may add a passage of up to five words as a Front-Cover Text, 4385 and a passage of up to 25 words as a Back-Cover Text, to the end of 4386 the list of Cover Texts in the Modified Version. Only one passage 4387 of Front-Cover Text and one of Back-Cover Text may be added by (or 4388 through arrangements made by) any one entity. If the Document 4389 already includes a cover text for the same cover, previously added 4390 by you or by arrangement made by the same entity you are acting on 4391 behalf of, you may not add another; but you may replace the old 4392 one, on explicit permission from the previous publisher that added 4393 the old one. 4394 4395 The author(s) and publisher(s) of the Document do not by this 4396 License give permission to use their names for publicity for or to 4397 assert or imply endorsement of any Modified Version. 4398 4399 5. COMBINING DOCUMENTS 4400 4401 You may combine the Document with other documents released under 4402 this License, under the terms defined in section 4 above for 4403 modified versions, provided that you include in the combination all 4404 of the Invariant Sections of all of the original documents, 4405 unmodified, and list them all as Invariant Sections of your 4406 combined work in its license notice, and that you preserve all 4407 their Warranty Disclaimers. 4408 4409 The combined work need only contain one copy of this License, and 4410 multiple identical Invariant Sections may be replaced with a single 4411 copy. If there are multiple Invariant Sections with the same name 4412 but different contents, make the title of each such section unique 4413 by adding at the end of it, in parentheses, the name of the 4414 original author or publisher of that section if known, or else a 4415 unique number. Make the same adjustment to the section titles in 4416 the list of Invariant Sections in the license notice of the 4417 combined work. 4418 4419 In the combination, you must combine any sections Entitled 4420 ���History��� in the various original documents, forming one section 4421 Entitled ���History���; likewise combine any sections Entitled 4422 ���Acknowledgements���, and any sections Entitled ���Dedications���. You 4423 must delete all sections Entitled ���Endorsements.��� 4424 4425 6. COLLECTIONS OF DOCUMENTS 4426 4427 You may make a collection consisting of the Document and other 4428 documents released under this License, and replace the individual 4429 copies of this License in the various documents with a single copy 4430 that is included in the collection, provided that you follow the 4431 rules of this License for verbatim copying of each of the documents 4432 in all other respects. 4433 4434 You may extract a single document from such a collection, and 4435 distribute it individually under this License, provided you insert 4436 a copy of this License into the extracted document, and follow this 4437 License in all other respects regarding verbatim copying of that 4438 document. 4439 4440 7. AGGREGATION WITH INDEPENDENT WORKS 4441 4442 A compilation of the Document or its derivatives with other 4443 separate and independent documents or works, in or on a volume of a 4444 storage or distribution medium, is called an ���aggregate��� if the 4445 copyright resulting from the compilation is not used to limit the 4446 legal rights of the compilation���s users beyond what the individual 4447 works permit. When the Document is included in an aggregate, this 4448 License does not apply to the other works in the aggregate which 4449 are not themselves derivative works of the Document. 4450 4451 If the Cover Text requirement of section 3 is applicable to these 4452 copies of the Document, then if the Document is less than one half 4453 of the entire aggregate, the Document���s Cover Texts may be placed 4454 on covers that bracket the Document within the aggregate, or the 4455 electronic equivalent of covers if the Document is in electronic 4456 form. Otherwise they must appear on printed covers that bracket 4457 the whole aggregate. 4458 4459 8. TRANSLATION 4460 4461 Translation is considered a kind of modification, so you may 4462 distribute translations of the Document under the terms of section 4463 4. Replacing Invariant Sections with translations requires special 4464 permission from their copyright holders, but you may include 4465 translations of some or all Invariant Sections in addition to the 4466 original versions of these Invariant Sections. You may include a 4467 translation of this License, and all the license notices in the 4468 Document, and any Warranty Disclaimers, provided that you also 4469 include the original English version of this License and the 4470 original versions of those notices and disclaimers. In case of a 4471 disagreement between the translation and the original version of 4472 this License or a notice or disclaimer, the original version will 4473 prevail. 4474 4475 If a section in the Document is Entitled ���Acknowledgements���, 4476 ���Dedications���, or ���History���, the requirement (section 4) to 4477 Preserve its Title (section 1) will typically require changing the 4478 actual title. 4479 4480 9. TERMINATION 4481 4482 You may not copy, modify, sublicense, or distribute the Document 4483 except as expressly provided for under this License. Any other 4484 attempt to copy, modify, sublicense or distribute the Document is 4485 void, and will automatically terminate your rights under this 4486 License. However, parties who have received copies, or rights, 4487 from you under this License will not have their licenses terminated 4488 so long as such parties remain in full compliance. 4489 4490 10. FUTURE REVISIONS OF THIS LICENSE 4491 4492 The Free Software Foundation may publish new, revised versions of 4493 the GNU Free Documentation License from time to time. Such new 4494 versions will be similar in spirit to the present version, but may 4495 differ in detail to address new problems or concerns. See 4496 <https://www.gnu.org/copyleft/>. 4497 4498 Each version of the License is given a distinguishing version 4499 number. If the Document specifies that a particular numbered 4500 version of this License ���or any later version��� applies to it, you 4501 have the option of following the terms and conditions either of 4502 that specified version or of any later version that has been 4503 published (not as a draft) by the Free Software Foundation. If the 4504 Document does not specify a version number of this License, you may 4505 choose any version ever published (not as a draft) by the Free 4506 Software Foundation. 4507 4508A.1 ADDENDUM: How to Use This License For Your Documents 4509======================================================== 4510 4511To use this License in a document you have written, include a copy of 4512the License in the document and put the following copyright and license 4513notices just after the title page: 4514 4515 Copyright (C) YEAR YOUR NAME. 4516 Permission is granted to copy, distribute and/or modify this document 4517 under the terms of the GNU Free Documentation License, Version 1.2 4518 or any later version published by the Free Software Foundation; 4519 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover 4520 Texts. A copy of the license is included in the section entitled ``GNU 4521 Free Documentation License''. 4522 4523 If you have Invariant Sections, Front-Cover Texts and Back-Cover 4524Texts, replace the ���with...Texts.��� line with this: 4525 4526 with the Invariant Sections being LIST THEIR TITLES, with 4527 the Front-Cover Texts being LIST, and with the Back-Cover Texts 4528 being LIST. 4529 4530 If you have Invariant Sections without Cover Texts, or some other 4531combination of the three, merge those two alternatives to suit the 4532situation. 4533 4534 If your document contains nontrivial examples of program code, we 4535recommend releasing these examples in parallel under your choice of free 4536software license, such as the GNU General Public License, to permit 4537their use in free software. 4538 4539 4540File: mpfr.info, Node: Concept Index, Next: Function and Type Index, Prev: GNU Free Documentation License, Up: Top 4541 4542Concept Index 4543************* 4544 4545[index] 4546* Menu: 4547 4548* Accuracy: MPFR Interface. (line 25) 4549* Arithmetic functions: Arithmetic Functions. (line 3) 4550* Assignment functions: Assignment Functions. (line 3) 4551* Combined initialization and assignment functions: Combined Initialization and Assignment Functions. 4552 (line 3) 4553* Comparison functions: Comparison Functions. (line 3) 4554* Compatibility with MPF: Compatibility with MPF. 4555 (line 3) 4556* Conditions for copying MPFR: Copying. (line 6) 4557* Conversion functions: Conversion Functions. (line 3) 4558* Copying conditions: Copying. (line 6) 4559* Custom interface: Custom Interface. (line 3) 4560* Exception related functions: Exception Related Functions. 4561 (line 3) 4562* Exponent: Nomenclature and Types. 4563 (line 47) 4564* Floating-point functions: MPFR Interface. (line 6) 4565* Floating-point number: Nomenclature and Types. 4566 (line 6) 4567* GNU Free Documentation License: GNU Free Documentation License. 4568 (line 6) 4569* GNU Free Documentation License <1>: GNU Free Documentation License. 4570 (line 6) 4571* Group of flags: Nomenclature and Types. 4572 (line 58) 4573* I/O functions: Input and Output Functions. 4574 (line 3) 4575* I/O functions <1>: Formatted Output Functions. 4576 (line 3) 4577* Initialization functions: Initialization Functions. 4578 (line 3) 4579* Input functions: Input and Output Functions. 4580 (line 3) 4581* Installation: Installing MPFR. (line 6) 4582* Integer related functions: Integer and Remainder Related Functions. 4583 (line 3) 4584* Internals: Internals. (line 3) 4585* intmax_t: Headers and Libraries. 4586 (line 22) 4587* inttypes.h: Headers and Libraries. 4588 (line 22) 4589* libmpfr: Headers and Libraries. 4590 (line 50) 4591* Libraries: Headers and Libraries. 4592 (line 50) 4593* Libtool: Headers and Libraries. 4594 (line 56) 4595* Limb: Internals. (line 6) 4596* Linking: Headers and Libraries. 4597 (line 50) 4598* Memory handling functions: Memory Handling Functions. 4599 (line 3) 4600* Miscellaneous float functions: Miscellaneous Functions. 4601 (line 3) 4602* mpfr.h: Headers and Libraries. 4603 (line 6) 4604* Output functions: Input and Output Functions. 4605 (line 3) 4606* Output functions <1>: Formatted Output Functions. 4607 (line 3) 4608* Precision: Nomenclature and Types. 4609 (line 33) 4610* Precision <1>: MPFR Interface. (line 17) 4611* Regular number: Nomenclature and Types. 4612 (line 6) 4613* Remainder related functions: Integer and Remainder Related Functions. 4614 (line 3) 4615* Reporting bugs: Reporting Bugs. (line 6) 4616* Rounding: Nomenclature and Types. 4617 (line 53) 4618* Rounding mode related functions: Rounding-Related Functions. 4619 (line 3) 4620* stdarg.h: Headers and Libraries. 4621 (line 19) 4622* stdint.h: Headers and Libraries. 4623 (line 22) 4624* stdio.h: Headers and Libraries. 4625 (line 12) 4626* Ternary value: Rounding. (line 75) 4627* Transcendental functions: Transcendental Functions. 4628 (line 3) 4629* uintmax_t: Headers and Libraries. 4630 (line 22) 4631 4632 4633File: mpfr.info, Node: Function and Type Index, Prev: Concept Index, Up: Top 4634 4635Function and Type Index 4636*********************** 4637 4638[index] 4639* Menu: 4640 4641* mpfr_abs: Arithmetic Functions. 4642 (line 145) 4643* mpfr_acos: Transcendental Functions. 4644 (line 168) 4645* mpfr_acosh: Transcendental Functions. 4646 (line 258) 4647* mpfr_acospi: Transcendental Functions. 4648 (line 190) 4649* mpfr_acosu: Transcendental Functions. 4650 (line 180) 4651* mpfr_add: Arithmetic Functions. 4652 (line 6) 4653* mpfr_add_d: Arithmetic Functions. 4654 (line 12) 4655* mpfr_add_q: Arithmetic Functions. 4656 (line 16) 4657* mpfr_add_si: Arithmetic Functions. 4658 (line 10) 4659* mpfr_add_ui: Arithmetic Functions. 4660 (line 8) 4661* mpfr_add_z: Arithmetic Functions. 4662 (line 14) 4663* mpfr_agm: Transcendental Functions. 4664 (line 355) 4665* mpfr_ai: Transcendental Functions. 4666 (line 366) 4667* mpfr_asin: Transcendental Functions. 4668 (line 169) 4669* mpfr_asinh: Transcendental Functions. 4670 (line 259) 4671* mpfr_asinpi: Transcendental Functions. 4672 (line 191) 4673* mpfr_asinu: Transcendental Functions. 4674 (line 182) 4675* mpfr_asprintf: Formatted Output Functions. 4676 (line 215) 4677* mpfr_atan: Transcendental Functions. 4678 (line 170) 4679* mpfr_atan2: Transcendental Functions. 4680 (line 196) 4681* mpfr_atan2pi: Transcendental Functions. 4682 (line 200) 4683* mpfr_atan2u: Transcendental Functions. 4684 (line 198) 4685* mpfr_atanh: Transcendental Functions. 4686 (line 260) 4687* mpfr_atanpi: Transcendental Functions. 4688 (line 192) 4689* mpfr_atanu: Transcendental Functions. 4690 (line 184) 4691* mpfr_beta: Transcendental Functions. 4692 (line 317) 4693* mpfr_buildopt_decimal_p: Miscellaneous Functions. 4694 (line 195) 4695* mpfr_buildopt_float128_p: Miscellaneous Functions. 4696 (line 190) 4697* mpfr_buildopt_gmpinternals_p: Miscellaneous Functions. 4698 (line 200) 4699* mpfr_buildopt_sharedcache_p: Miscellaneous Functions. 4700 (line 205) 4701* mpfr_buildopt_tls_p: Miscellaneous Functions. 4702 (line 184) 4703* mpfr_buildopt_tune_case: Miscellaneous Functions. 4704 (line 213) 4705* mpfr_can_round: Rounding-Related Functions. 4706 (line 40) 4707* mpfr_cbrt: Arithmetic Functions. 4708 (line 118) 4709* mpfr_ceil: Integer and Remainder Related Functions. 4710 (line 7) 4711* mpfr_check_range: Exception Related Functions. 4712 (line 50) 4713* mpfr_clear: Initialization Functions. 4714 (line 33) 4715* mpfr_clears: Initialization Functions. 4716 (line 38) 4717* mpfr_clear_divby0: Exception Related Functions. 4718 (line 154) 4719* mpfr_clear_erangeflag: Exception Related Functions. 4720 (line 157) 4721* mpfr_clear_flags: Exception Related Functions. 4722 (line 161) 4723* mpfr_clear_inexflag: Exception Related Functions. 4724 (line 156) 4725* mpfr_clear_nanflag: Exception Related Functions. 4726 (line 155) 4727* mpfr_clear_overflow: Exception Related Functions. 4728 (line 153) 4729* mpfr_clear_underflow: Exception Related Functions. 4730 (line 152) 4731* mpfr_cmp: Comparison Functions. 4732 (line 6) 4733* mpfr_cmpabs: Comparison Functions. 4734 (line 34) 4735* mpfr_cmpabs_ui: Comparison Functions. 4736 (line 35) 4737* mpfr_cmp_d: Comparison Functions. 4738 (line 9) 4739* mpfr_cmp_f: Comparison Functions. 4740 (line 13) 4741* mpfr_cmp_ld: Comparison Functions. 4742 (line 10) 4743* mpfr_cmp_q: Comparison Functions. 4744 (line 12) 4745* mpfr_cmp_si: Comparison Functions. 4746 (line 8) 4747* mpfr_cmp_si_2exp: Comparison Functions. 4748 (line 29) 4749* mpfr_cmp_ui: Comparison Functions. 4750 (line 7) 4751* mpfr_cmp_ui_2exp: Comparison Functions. 4752 (line 27) 4753* mpfr_cmp_z: Comparison Functions. 4754 (line 11) 4755* mpfr_compound_si: Transcendental Functions. 4756 (line 112) 4757* mpfr_const_catalan: Transcendental Functions. 4758 (line 377) 4759* mpfr_const_euler: Transcendental Functions. 4760 (line 376) 4761* mpfr_const_log2: Transcendental Functions. 4762 (line 374) 4763* mpfr_const_pi: Transcendental Functions. 4764 (line 375) 4765* mpfr_copysign: Miscellaneous Functions. 4766 (line 137) 4767* mpfr_cos: Transcendental Functions. 4768 (line 123) 4769* mpfr_cosh: Transcendental Functions. 4770 (line 238) 4771* mpfr_cospi: Transcendental Functions. 4772 (line 145) 4773* mpfr_cosu: Transcendental Functions. 4774 (line 129) 4775* mpfr_cot: Transcendental Functions. 4776 (line 164) 4777* mpfr_coth: Transcendental Functions. 4778 (line 254) 4779* mpfr_csc: Transcendental Functions. 4780 (line 163) 4781* mpfr_csch: Transcendental Functions. 4782 (line 253) 4783* mpfr_custom_get_exp: Custom Interface. (line 79) 4784* mpfr_custom_get_kind: Custom Interface. (line 69) 4785* mpfr_custom_get_significand: Custom Interface. (line 74) 4786* mpfr_custom_get_size: Custom Interface. (line 40) 4787* mpfr_custom_init: Custom Interface. (line 44) 4788* mpfr_custom_init_set: Custom Interface. (line 51) 4789* mpfr_custom_move: Custom Interface. (line 88) 4790* MPFR_DECL_INIT: Initialization Functions. 4791 (line 77) 4792* mpfr_digamma: Transcendental Functions. 4793 (line 312) 4794* mpfr_dim: Arithmetic Functions. 4795 (line 156) 4796* mpfr_div: Arithmetic Functions. 4797 (line 75) 4798* mpfr_divby0_p: Exception Related Functions. 4799 (line 177) 4800* mpfr_div_2exp: Compatibility with MPF. 4801 (line 56) 4802* mpfr_div_2si: Arithmetic Functions. 4803 (line 171) 4804* mpfr_div_2ui: Arithmetic Functions. 4805 (line 169) 4806* mpfr_div_d: Arithmetic Functions. 4807 (line 87) 4808* mpfr_div_q: Arithmetic Functions. 4809 (line 91) 4810* mpfr_div_si: Arithmetic Functions. 4811 (line 83) 4812* mpfr_div_ui: Arithmetic Functions. 4813 (line 79) 4814* mpfr_div_z: Arithmetic Functions. 4815 (line 89) 4816* mpfr_dot: Arithmetic Functions. 4817 (line 227) 4818* mpfr_dump: Input and Output Functions. 4819 (line 79) 4820* mpfr_d_div: Arithmetic Functions. 4821 (line 85) 4822* mpfr_d_sub: Arithmetic Functions. 4823 (line 36) 4824* mpfr_eint: Transcendental Functions. 4825 (line 264) 4826* mpfr_eq: Compatibility with MPF. 4827 (line 35) 4828* mpfr_equal_p: Comparison Functions. 4829 (line 60) 4830* mpfr_erandom: Miscellaneous Functions. 4831 (line 109) 4832* mpfr_erangeflag_p: Exception Related Functions. 4833 (line 180) 4834* mpfr_erf: Transcendental Functions. 4835 (line 329) 4836* mpfr_erfc: Transcendental Functions. 4837 (line 330) 4838* mpfr_exp: Transcendental Functions. 4839 (line 44) 4840* mpfr_exp10: Transcendental Functions. 4841 (line 46) 4842* mpfr_exp10m1: Transcendental Functions. 4843 (line 52) 4844* mpfr_exp2: Transcendental Functions. 4845 (line 45) 4846* mpfr_exp2m1: Transcendental Functions. 4847 (line 51) 4848* mpfr_expm1: Transcendental Functions. 4849 (line 50) 4850* mpfr_exp_t: Nomenclature and Types. 4851 (line 47) 4852* mpfr_fac_ui: Arithmetic Functions. 4853 (line 177) 4854* mpfr_fits_intmax_p: Conversion Functions. 4855 (line 186) 4856* mpfr_fits_sint_p: Conversion Functions. 4857 (line 182) 4858* mpfr_fits_slong_p: Conversion Functions. 4859 (line 180) 4860* mpfr_fits_sshort_p: Conversion Functions. 4861 (line 184) 4862* mpfr_fits_uintmax_p: Conversion Functions. 4863 (line 185) 4864* mpfr_fits_uint_p: Conversion Functions. 4865 (line 181) 4866* mpfr_fits_ulong_p: Conversion Functions. 4867 (line 179) 4868* mpfr_fits_ushort_p: Conversion Functions. 4869 (line 183) 4870* mpfr_flags_clear: Exception Related Functions. 4871 (line 191) 4872* mpfr_flags_restore: Exception Related Functions. 4873 (line 215) 4874* mpfr_flags_save: Exception Related Functions. 4875 (line 211) 4876* mpfr_flags_set: Exception Related Functions. 4877 (line 194) 4878* mpfr_flags_t: Nomenclature and Types. 4879 (line 58) 4880* mpfr_flags_test: Exception Related Functions. 4881 (line 197) 4882* mpfr_floor: Integer and Remainder Related Functions. 4883 (line 8) 4884* mpfr_fma: Arithmetic Functions. 4885 (line 181) 4886* mpfr_fmma: Arithmetic Functions. 4887 (line 191) 4888* mpfr_fmms: Arithmetic Functions. 4889 (line 193) 4890* mpfr_fmod: Integer and Remainder Related Functions. 4891 (line 107) 4892* mpfr_fmodquo: Integer and Remainder Related Functions. 4893 (line 111) 4894* mpfr_fmod_ui: Integer and Remainder Related Functions. 4895 (line 109) 4896* mpfr_fms: Arithmetic Functions. 4897 (line 183) 4898* mpfr_fpif_export: Input and Output Functions. 4899 (line 54) 4900* mpfr_fpif_import: Input and Output Functions. 4901 (line 65) 4902* mpfr_fprintf: Formatted Output Functions. 4903 (line 179) 4904* mpfr_frac: Integer and Remainder Related Functions. 4905 (line 90) 4906* mpfr_free_cache: Memory Handling Functions. 4907 (line 9) 4908* mpfr_free_cache2: Memory Handling Functions. 4909 (line 16) 4910* mpfr_free_pool: Memory Handling Functions. 4911 (line 30) 4912* mpfr_free_str: Conversion Functions. 4913 (line 174) 4914* mpfr_frexp: Conversion Functions. 4915 (line 53) 4916* mpfr_gamma: Transcendental Functions. 4917 (line 280) 4918* mpfr_gamma_inc: Transcendental Functions. 4919 (line 281) 4920* mpfr_get_d: Conversion Functions. 4921 (line 7) 4922* mpfr_get_decimal128: Conversion Functions. 4923 (line 11) 4924* mpfr_get_decimal64: Conversion Functions. 4925 (line 10) 4926* mpfr_get_default_prec: Initialization Functions. 4927 (line 115) 4928* mpfr_get_default_rounding_mode: Rounding-Related Functions. 4929 (line 10) 4930* mpfr_get_d_2exp: Conversion Functions. 4931 (line 40) 4932* mpfr_get_emax: Exception Related Functions. 4933 (line 7) 4934* mpfr_get_emax_max: Exception Related Functions. 4935 (line 43) 4936* mpfr_get_emax_min: Exception Related Functions. 4937 (line 42) 4938* mpfr_get_emin: Exception Related Functions. 4939 (line 6) 4940* mpfr_get_emin_max: Exception Related Functions. 4941 (line 41) 4942* mpfr_get_emin_min: Exception Related Functions. 4943 (line 40) 4944* mpfr_get_exp: Miscellaneous Functions. 4945 (line 115) 4946* mpfr_get_f: Conversion Functions. 4947 (line 89) 4948* mpfr_get_float128: Conversion Functions. 4949 (line 9) 4950* mpfr_get_flt: Conversion Functions. 4951 (line 6) 4952* mpfr_get_ld: Conversion Functions. 4953 (line 8) 4954* mpfr_get_ld_2exp: Conversion Functions. 4955 (line 42) 4956* mpfr_get_patches: Miscellaneous Functions. 4957 (line 175) 4958* mpfr_get_prec: Initialization Functions. 4959 (line 152) 4960* mpfr_get_q: Conversion Functions. 4961 (line 84) 4962* mpfr_get_si: Conversion Functions. 4963 (line 25) 4964* mpfr_get_sj: Conversion Functions. 4965 (line 27) 4966* mpfr_get_str: Conversion Functions. 4967 (line 114) 4968* mpfr_get_str_ndigits: Conversion Functions. 4969 (line 102) 4970* mpfr_get_ui: Conversion Functions. 4971 (line 26) 4972* mpfr_get_uj: Conversion Functions. 4973 (line 28) 4974* mpfr_get_version: Miscellaneous Functions. 4975 (line 144) 4976* mpfr_get_z: Conversion Functions. 4977 (line 75) 4978* mpfr_get_z_2exp: Conversion Functions. 4979 (line 62) 4980* mpfr_grandom: Miscellaneous Functions. 4981 (line 79) 4982* mpfr_greaterequal_p: Comparison Functions. 4983 (line 57) 4984* mpfr_greater_p: Comparison Functions. 4985 (line 56) 4986* mpfr_hypot: Arithmetic Functions. 4987 (line 201) 4988* mpfr_inexflag_p: Exception Related Functions. 4989 (line 179) 4990* mpfr_inf_p: Comparison Functions. 4991 (line 41) 4992* mpfr_init: Initialization Functions. 4993 (line 56) 4994* mpfr_init2: Initialization Functions. 4995 (line 10) 4996* mpfr_inits: Initialization Functions. 4997 (line 65) 4998* mpfr_inits2: Initialization Functions. 4999 (line 25) 5000* mpfr_init_set: Combined Initialization and Assignment Functions. 5001 (line 6) 5002* mpfr_init_set_d: Combined Initialization and Assignment Functions. 5003 (line 11) 5004* mpfr_init_set_f: Combined Initialization and Assignment Functions. 5005 (line 16) 5006* mpfr_init_set_ld: Combined Initialization and Assignment Functions. 5007 (line 12) 5008* mpfr_init_set_q: Combined Initialization and Assignment Functions. 5009 (line 15) 5010* mpfr_init_set_si: Combined Initialization and Assignment Functions. 5011 (line 9) 5012* mpfr_init_set_str: Combined Initialization and Assignment Functions. 5013 (line 21) 5014* mpfr_init_set_ui: Combined Initialization and Assignment Functions. 5015 (line 7) 5016* mpfr_init_set_z: Combined Initialization and Assignment Functions. 5017 (line 14) 5018* mpfr_inp_str: Input and Output Functions. 5019 (line 39) 5020* mpfr_integer_p: Integer and Remainder Related Functions. 5021 (line 139) 5022* mpfr_j0: Transcendental Functions. 5023 (line 334) 5024* mpfr_j1: Transcendental Functions. 5025 (line 335) 5026* mpfr_jn: Transcendental Functions. 5027 (line 336) 5028* mpfr_lessequal_p: Comparison Functions. 5029 (line 59) 5030* mpfr_lessgreater_p: Comparison Functions. 5031 (line 65) 5032* mpfr_less_p: Comparison Functions. 5033 (line 58) 5034* mpfr_lgamma: Transcendental Functions. 5035 (line 302) 5036* mpfr_li2: Transcendental Functions. 5037 (line 275) 5038* mpfr_lngamma: Transcendental Functions. 5039 (line 294) 5040* mpfr_log: Transcendental Functions. 5041 (line 26) 5042* mpfr_log10: Transcendental Functions. 5043 (line 30) 5044* mpfr_log10p1: Transcendental Functions. 5045 (line 39) 5046* mpfr_log1p: Transcendental Functions. 5047 (line 37) 5048* mpfr_log2: Transcendental Functions. 5049 (line 29) 5050* mpfr_log2p1: Transcendental Functions. 5051 (line 38) 5052* mpfr_log_ui: Transcendental Functions. 5053 (line 27) 5054* mpfr_max: Miscellaneous Functions. 5055 (line 26) 5056* mpfr_min: Miscellaneous Functions. 5057 (line 24) 5058* mpfr_min_prec: Rounding-Related Functions. 5059 (line 86) 5060* mpfr_modf: Integer and Remainder Related Functions. 5061 (line 97) 5062* mpfr_mp_memory_cleanup: Memory Handling Functions. 5063 (line 35) 5064* mpfr_mul: Arithmetic Functions. 5065 (line 53) 5066* mpfr_mul_2exp: Compatibility with MPF. 5067 (line 54) 5068* mpfr_mul_2si: Arithmetic Functions. 5069 (line 164) 5070* mpfr_mul_2ui: Arithmetic Functions. 5071 (line 162) 5072* mpfr_mul_d: Arithmetic Functions. 5073 (line 59) 5074* mpfr_mul_q: Arithmetic Functions. 5075 (line 63) 5076* mpfr_mul_si: Arithmetic Functions. 5077 (line 57) 5078* mpfr_mul_ui: Arithmetic Functions. 5079 (line 55) 5080* mpfr_mul_z: Arithmetic Functions. 5081 (line 61) 5082* mpfr_nanflag_p: Exception Related Functions. 5083 (line 178) 5084* mpfr_nan_p: Comparison Functions. 5085 (line 40) 5086* mpfr_neg: Arithmetic Functions. 5087 (line 144) 5088* mpfr_nextabove: Miscellaneous Functions. 5089 (line 20) 5090* mpfr_nextbelow: Miscellaneous Functions. 5091 (line 21) 5092* mpfr_nexttoward: Miscellaneous Functions. 5093 (line 6) 5094* mpfr_nrandom: Miscellaneous Functions. 5095 (line 77) 5096* mpfr_number_p: Comparison Functions. 5097 (line 42) 5098* mpfr_out_str: Input and Output Functions. 5099 (line 15) 5100* mpfr_overflow_p: Exception Related Functions. 5101 (line 176) 5102* mpfr_pow: Transcendental Functions. 5103 (line 58) 5104* mpfr_pown: Transcendental Functions. 5105 (line 70) 5106* mpfr_powr: Transcendental Functions. 5107 (line 60) 5108* mpfr_pow_si: Transcendental Functions. 5109 (line 64) 5110* mpfr_pow_sj: Transcendental Functions. 5111 (line 68) 5112* mpfr_pow_ui: Transcendental Functions. 5113 (line 62) 5114* mpfr_pow_uj: Transcendental Functions. 5115 (line 66) 5116* mpfr_pow_z: Transcendental Functions. 5117 (line 72) 5118* mpfr_prec_round: Rounding-Related Functions. 5119 (line 13) 5120* mpfr_prec_t: Nomenclature and Types. 5121 (line 33) 5122* mpfr_printf: Formatted Output Functions. 5123 (line 186) 5124* mpfr_print_rnd_mode: Rounding-Related Functions. 5125 (line 90) 5126* mpfr_ptr: Nomenclature and Types. 5127 (line 6) 5128* mpfr_rec_sqrt: Arithmetic Functions. 5129 (line 109) 5130* mpfr_regular_p: Comparison Functions. 5131 (line 44) 5132* mpfr_reldiff: Compatibility with MPF. 5133 (line 46) 5134* mpfr_remainder: Integer and Remainder Related Functions. 5135 (line 113) 5136* mpfr_remquo: Integer and Remainder Related Functions. 5137 (line 115) 5138* mpfr_rint: Integer and Remainder Related Functions. 5139 (line 6) 5140* mpfr_rint_ceil: Integer and Remainder Related Functions. 5141 (line 53) 5142* mpfr_rint_floor: Integer and Remainder Related Functions. 5143 (line 54) 5144* mpfr_rint_round: Integer and Remainder Related Functions. 5145 (line 56) 5146* mpfr_rint_roundeven: Integer and Remainder Related Functions. 5147 (line 58) 5148* mpfr_rint_trunc: Integer and Remainder Related Functions. 5149 (line 60) 5150* mpfr_rnd_t: Nomenclature and Types. 5151 (line 53) 5152* mpfr_root: Arithmetic Functions. 5153 (line 133) 5154* mpfr_rootn_si: Arithmetic Functions. 5155 (line 121) 5156* mpfr_rootn_ui: Arithmetic Functions. 5157 (line 119) 5158* mpfr_round: Integer and Remainder Related Functions. 5159 (line 9) 5160* mpfr_roundeven: Integer and Remainder Related Functions. 5161 (line 10) 5162* mpfr_round_nearest_away: Rounding-Related Functions. 5163 (line 96) 5164* mpfr_sec: Transcendental Functions. 5165 (line 162) 5166* mpfr_sech: Transcendental Functions. 5167 (line 252) 5168* mpfr_set: Assignment Functions. 5169 (line 9) 5170* mpfr_setsign: Miscellaneous Functions. 5171 (line 131) 5172* mpfr_set_d: Assignment Functions. 5173 (line 16) 5174* mpfr_set_decimal128: Assignment Functions. 5175 (line 23) 5176* mpfr_set_decimal64: Assignment Functions. 5177 (line 21) 5178* mpfr_set_default_prec: Initialization Functions. 5179 (line 103) 5180* mpfr_set_default_rounding_mode: Rounding-Related Functions. 5181 (line 6) 5182* mpfr_set_divby0: Exception Related Functions. 5183 (line 168) 5184* mpfr_set_emax: Exception Related Functions. 5185 (line 16) 5186* mpfr_set_emin: Exception Related Functions. 5187 (line 15) 5188* mpfr_set_erangeflag: Exception Related Functions. 5189 (line 171) 5190* mpfr_set_exp: Miscellaneous Functions. 5191 (line 122) 5192* mpfr_set_f: Assignment Functions. 5193 (line 27) 5194* mpfr_set_float128: Assignment Functions. 5195 (line 19) 5196* mpfr_set_flt: Assignment Functions. 5197 (line 15) 5198* mpfr_set_inexflag: Exception Related Functions. 5199 (line 170) 5200* mpfr_set_inf: Assignment Functions. 5201 (line 158) 5202* mpfr_set_ld: Assignment Functions. 5203 (line 17) 5204* mpfr_set_nan: Assignment Functions. 5205 (line 157) 5206* mpfr_set_nanflag: Exception Related Functions. 5207 (line 169) 5208* mpfr_set_overflow: Exception Related Functions. 5209 (line 167) 5210* mpfr_set_prec: Initialization Functions. 5211 (line 138) 5212* mpfr_set_prec_raw: Compatibility with MPF. 5213 (line 29) 5214* mpfr_set_q: Assignment Functions. 5215 (line 26) 5216* mpfr_set_si: Assignment Functions. 5217 (line 12) 5218* mpfr_set_si_2exp: Assignment Functions. 5219 (line 63) 5220* mpfr_set_sj: Assignment Functions. 5221 (line 14) 5222* mpfr_set_sj_2exp: Assignment Functions. 5223 (line 67) 5224* mpfr_set_str: Assignment Functions. 5225 (line 75) 5226* mpfr_set_ui: Assignment Functions. 5227 (line 10) 5228* mpfr_set_ui_2exp: Assignment Functions. 5229 (line 61) 5230* mpfr_set_uj: Assignment Functions. 5231 (line 13) 5232* mpfr_set_uj_2exp: Assignment Functions. 5233 (line 65) 5234* mpfr_set_underflow: Exception Related Functions. 5235 (line 166) 5236* mpfr_set_z: Assignment Functions. 5237 (line 25) 5238* mpfr_set_zero: Assignment Functions. 5239 (line 159) 5240* mpfr_set_z_2exp: Assignment Functions. 5241 (line 69) 5242* mpfr_sgn: Comparison Functions. 5243 (line 50) 5244* mpfr_signbit: Miscellaneous Functions. 5245 (line 127) 5246* mpfr_sin: Transcendental Functions. 5247 (line 124) 5248* mpfr_sinh: Transcendental Functions. 5249 (line 239) 5250* mpfr_sinh_cosh: Transcendental Functions. 5251 (line 244) 5252* mpfr_sinpi: Transcendental Functions. 5253 (line 146) 5254* mpfr_sinu: Transcendental Functions. 5255 (line 131) 5256* mpfr_sin_cos: Transcendental Functions. 5257 (line 152) 5258* mpfr_si_div: Arithmetic Functions. 5259 (line 81) 5260* mpfr_si_sub: Arithmetic Functions. 5261 (line 32) 5262* mpfr_snprintf: Formatted Output Functions. 5263 (line 202) 5264* mpfr_sprintf: Formatted Output Functions. 5265 (line 192) 5266* mpfr_sqr: Arithmetic Functions. 5267 (line 72) 5268* mpfr_sqrt: Arithmetic Functions. 5269 (line 101) 5270* mpfr_sqrt_ui: Arithmetic Functions. 5271 (line 102) 5272* mpfr_srcptr: Nomenclature and Types. 5273 (line 6) 5274* mpfr_strtofr: Assignment Functions. 5275 (line 94) 5276* mpfr_sub: Arithmetic Functions. 5277 (line 26) 5278* mpfr_subnormalize: Exception Related Functions. 5279 (line 73) 5280* mpfr_sub_d: Arithmetic Functions. 5281 (line 38) 5282* mpfr_sub_q: Arithmetic Functions. 5283 (line 44) 5284* mpfr_sub_si: Arithmetic Functions. 5285 (line 34) 5286* mpfr_sub_ui: Arithmetic Functions. 5287 (line 30) 5288* mpfr_sub_z: Arithmetic Functions. 5289 (line 42) 5290* mpfr_sum: Arithmetic Functions. 5291 (line 210) 5292* mpfr_swap: Assignment Functions. 5293 (line 166) 5294* mpfr_t: Nomenclature and Types. 5295 (line 6) 5296* mpfr_tan: Transcendental Functions. 5297 (line 125) 5298* mpfr_tanh: Transcendental Functions. 5299 (line 240) 5300* mpfr_tanpi: Transcendental Functions. 5301 (line 147) 5302* mpfr_tanu: Transcendental Functions. 5303 (line 133) 5304* mpfr_total_order_p: Comparison Functions. 5305 (line 74) 5306* mpfr_trunc: Integer and Remainder Related Functions. 5307 (line 11) 5308* mpfr_ui_div: Arithmetic Functions. 5309 (line 77) 5310* mpfr_ui_pow: Transcendental Functions. 5311 (line 76) 5312* mpfr_ui_pow_ui: Transcendental Functions. 5313 (line 74) 5314* mpfr_ui_sub: Arithmetic Functions. 5315 (line 28) 5316* mpfr_underflow_p: Exception Related Functions. 5317 (line 175) 5318* mpfr_unordered_p: Comparison Functions. 5319 (line 70) 5320* mpfr_urandom: Miscellaneous Functions. 5321 (line 58) 5322* mpfr_urandomb: Miscellaneous Functions. 5323 (line 39) 5324* mpfr_vasprintf: Formatted Output Functions. 5325 (line 216) 5326* MPFR_VERSION: Miscellaneous Functions. 5327 (line 147) 5328* MPFR_VERSION_MAJOR: Miscellaneous Functions. 5329 (line 148) 5330* MPFR_VERSION_MINOR: Miscellaneous Functions. 5331 (line 149) 5332* MPFR_VERSION_NUM: Miscellaneous Functions. 5333 (line 167) 5334* MPFR_VERSION_PATCHLEVEL: Miscellaneous Functions. 5335 (line 150) 5336* MPFR_VERSION_STRING: Miscellaneous Functions. 5337 (line 151) 5338* mpfr_vfprintf: Formatted Output Functions. 5339 (line 180) 5340* mpfr_vprintf: Formatted Output Functions. 5341 (line 187) 5342* mpfr_vsnprintf: Formatted Output Functions. 5343 (line 204) 5344* mpfr_vsprintf: Formatted Output Functions. 5345 (line 193) 5346* mpfr_y0: Transcendental Functions. 5347 (line 345) 5348* mpfr_y1: Transcendental Functions. 5349 (line 346) 5350* mpfr_yn: Transcendental Functions. 5351 (line 347) 5352* mpfr_zero_p: Comparison Functions. 5353 (line 43) 5354* mpfr_zeta: Transcendental Functions. 5355 (line 323) 5356* mpfr_zeta_ui: Transcendental Functions. 5357 (line 324) 5358* mpfr_z_sub: Arithmetic Functions. 5359 (line 40) 5360 5361 5362 5363Tag Table: 5364Node: Top777 5365Node: Copying2044 5366Node: Introduction to MPFR3808 5367Node: Installing MPFR6204 5368Node: Reporting Bugs11769 5369Node: MPFR Basics13800 5370Node: Headers and Libraries14154 5371Node: Nomenclature and Types17752 5372Node: MPFR Variable Conventions21070 5373Node: Rounding22606 5374Ref: ternary value26414 5375Node: Floating-Point Values on Special Numbers28405 5376Node: Exceptions31998 5377Node: Memory Handling35842 5378Node: Getting the Best Efficiency Out of MPFR39593 5379Node: MPFR Interface40609 5380Node: Initialization Functions42929 5381Node: Assignment Functions50458 5382Node: Combined Initialization and Assignment Functions60763 5383Node: Conversion Functions62064 5384Ref: mpfr_get_str_ndigits67975 5385Ref: mpfr_get_str68606 5386Node: Arithmetic Functions73578 5387Node: Comparison Functions85862 5388Node: Transcendental Functions90153 5389Ref: mpfr_pow93372 5390Node: Input and Output Functions111192 5391Node: Formatted Output Functions116694 5392Node: Integer and Remainder Related Functions127816 5393Node: Rounding-Related Functions135539 5394Node: Miscellaneous Functions142161 5395Node: Exception Related Functions153203 5396Node: Memory Handling Functions163456 5397Node: Compatibility with MPF165347 5398Node: Custom Interface168522 5399Node: Internals173308 5400Node: API Compatibility174852 5401Node: Type and Macro Changes176800 5402Node: Added Functions179985 5403Node: Changed Functions185557 5404Node: Removed Functions193324 5405Node: Other Changes194054 5406Node: MPFR and the IEEE 754 Standard195757 5407Node: Contributors198411 5408Node: References201550 5409Node: GNU Free Documentation License203613 5410Node: Concept Index226207 5411Node: Function and Type Index232280 5412 5413End Tag Table 5414 5415 5416Local Variables: 5417coding: utf-8 5418End: 5419