1*367b8279SmrgThis is mpc.info, produced by makeinfo version 7.0 from mpc.texi. 28fa80f29Smrg 38fa80f29SmrgThis manual is for GNU MPC, a library for multiple precision complex 4*367b8279Smrgarithmetic, version 1.3.1 of December 2022. 58fa80f29Smrg 6*367b8279Smrg Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 7*367b8279Smrg2011, 2012, 2013, 2016, 2018, 2020, 2022 INRIA 88fa80f29Smrg 98fa80f29Smrg Permission is granted to copy, distribute and/or modify this 108fa80f29Smrg document under the terms of the GNU Free Documentation License, 118fa80f29Smrg Version 1.3 or any later version published by the Free Software 128fa80f29Smrg Foundation; with no Invariant Sections. A copy of the license is 13*367b8279Smrg included in the section entitled “GNU Free Documentation License.” 148fa80f29SmrgINFO-DIR-SECTION GNU Packages 158fa80f29SmrgSTART-INFO-DIR-ENTRY 168fa80f29Smrg* mpc: (mpc)Multiple Precision Complex Library. 178fa80f29SmrgEND-INFO-DIR-ENTRY 188fa80f29Smrg 198fa80f29Smrg 208fa80f29SmrgFile: mpc.info, Node: Top, Next: Copying, Up: (dir) 218fa80f29Smrg 228fa80f29SmrgGNU MPC 238fa80f29Smrg******* 248fa80f29Smrg 258fa80f29SmrgThis manual documents how to install and use the GNU Multiple Precision 26*367b8279SmrgComplex Library, version 1.3.1 278fa80f29Smrg 288fa80f29Smrg* Menu: 298fa80f29Smrg 308fa80f29Smrg* Copying:: GNU MPC Copying Conditions (LGPL). 318fa80f29Smrg* Introduction to GNU MPC:: Brief introduction to GNU MPC. 328fa80f29Smrg* Installing GNU MPC:: How to configure and compile the GNU MPC library. 338fa80f29Smrg* Reporting Bugs:: How to usefully report bugs. 348fa80f29Smrg* GNU MPC Basics:: What every GNU MPC user should know. 358fa80f29Smrg* Complex Functions:: Functions for arithmetic on complex numbers. 36*367b8279Smrg* Ball Arithmetic:: Types and functions for complex balls. 378fa80f29Smrg* References:: 388fa80f29Smrg* Concept Index:: 398fa80f29Smrg* Function Index:: 40*367b8279Smrg* Type Index:: 418fa80f29Smrg* GNU Free Documentation License:: 428fa80f29Smrg 438fa80f29Smrg 448fa80f29SmrgFile: mpc.info, Node: Copying, Next: Introduction to GNU MPC, Prev: Top, Up: Top 458fa80f29Smrg 468fa80f29SmrgGNU MPC Copying Conditions 478fa80f29Smrg************************** 488fa80f29Smrg 498fa80f29SmrgGNU MPC is free software; you can redistribute it and/or modify it under 508fa80f29Smrgthe terms of the GNU Lesser General Public License as published by the 518fa80f29SmrgFree Software Foundation; either version 3 of the License, or (at your 528fa80f29Smrgoption) any later version. 538fa80f29Smrg 548fa80f29Smrg GNU MPC is distributed in the hope that it will be useful, but 558fa80f29SmrgWITHOUT ANY WARRANTY; without even the implied warranty of 568fa80f29SmrgMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 578fa80f29SmrgGeneral Public License for more details. 588fa80f29Smrg 598fa80f29Smrg You should have received a copy of the GNU Lesser General Public 608fa80f29SmrgLicense along with this program. If not, see 61062d2d48Smrg<http://www.gnu.org/licenses/>. 628fa80f29Smrg 638fa80f29Smrg 648fa80f29SmrgFile: mpc.info, Node: Introduction to GNU MPC, Next: Installing GNU MPC, Prev: Copying, Up: Top 658fa80f29Smrg 668fa80f29Smrg1 Introduction to GNU MPC 678fa80f29Smrg************************* 688fa80f29Smrg 698fa80f29SmrgGNU MPC is a portable library written in C for arbitrary precision 708fa80f29Smrgarithmetic on complex numbers providing correct rounding. It implements 71062d2d48Smrga multiprecision equivalent of the C99 standard. It builds upon the GNU 72062d2d48SmrgMP and the GNU MPFR libraries. 738fa80f29Smrg 748fa80f29Smrg1.1 How to use this Manual 758fa80f29Smrg========================== 768fa80f29Smrg 77062d2d48SmrgEveryone should read *note GNU MPC Basics::. If you need to install the 78062d2d48Smrglibrary yourself, you need to read *note Installing GNU MPC::, too. 798fa80f29Smrg 80062d2d48Smrg The remainder of the manual can be used for later reference, although 81062d2d48Smrgit is probably a good idea to skim through it. 828fa80f29Smrg 838fa80f29Smrg 848fa80f29SmrgFile: mpc.info, Node: Installing GNU MPC, Next: Reporting Bugs, Prev: Introduction to GNU MPC, Up: Top 858fa80f29Smrg 868fa80f29Smrg2 Installing GNU MPC 878fa80f29Smrg******************** 888fa80f29Smrg 8939f28e1eSmrgTo build GNU MPC, you first have to install GNU MP (version 5.0.0 or 9090a8ff21Smrghigher) and GNU MPFR (version 4.1.0 or higher) on your computer. You 918fa80f29Smrgneed a C compiler; GCC version 4.4 or higher is recommended, since GNU 928fa80f29SmrgMPC may trigger a bug in previous versions, see the thread at 93*367b8279Smrg<https://sympa.inria.fr/sympa/arc/mpc-discuss/2011-02/msg00024.html>. 94*367b8279SmrgAnd you need a standard Unix ‘make’ program, plus some other standard 958fa80f29SmrgUnix utility programs. 968fa80f29Smrg 978fa80f29Smrg Here are the steps needed to install the library on Unix systems: 988fa80f29Smrg 99*367b8279Smrg 1. ‘tar xzf mpc-1.3.1.tar.gz’ 1008fa80f29Smrg 101*367b8279Smrg 2. ‘cd mpc-1.3.1’ 1028fa80f29Smrg 103*367b8279Smrg 3. ‘./configure’ 1048fa80f29Smrg 1058fa80f29Smrg if GMP and GNU MPFR are installed into standard directories, that 1068fa80f29Smrg is, directories that are searched by default by the compiler and 1078fa80f29Smrg the linking tools. 1088fa80f29Smrg 109*367b8279Smrg ‘./configure --with-gmp=<gmp_install_dir>’ 1108fa80f29Smrg 1118fa80f29Smrg is used to indicate a different location where GMP is installed. 1128fa80f29Smrg Alternatively, you can specify directly GMP include and GMP lib 113*367b8279Smrg directories with ‘./configure --with-gmp-lib=<gmp_lib_dir> 114*367b8279Smrg --with-gmp-include=<gmp_include_dir>’. 1158fa80f29Smrg 116*367b8279Smrg ‘./configure --with-mpfr=<mpfr_install_dir>’ 1178fa80f29Smrg 1188fa80f29Smrg is used to indicate a different location where GNU MPFR is 1198fa80f29Smrg installed. Alternatively, you can specify directly GNU MPFR 120*367b8279Smrg include and GNU MPFR lib directories with ‘./configure 1218fa80f29Smrg --with-mpf-lib=<mpfr_lib_dir> 122*367b8279Smrg --with-mpfr-include=<mpfr_include_dir>’. 1238fa80f29Smrg 124*367b8279Smrg Another useful parameter is ‘--prefix’, which can be used to 1258fa80f29Smrg specify an alternative installation location instead of 126*367b8279Smrg ‘/usr/local’; see ‘make install’ below. 1278fa80f29Smrg 128*367b8279Smrg To enable checking for memory leaks using ‘valgrind’ during ‘make 129*367b8279Smrg check’, add the parameter ‘--enable-valgrind-tests’. 1308fa80f29Smrg 1318fa80f29Smrg If for debugging purposes you wish to log calls to GNU MPC 1328fa80f29Smrg functions from within your code, add the parameter 133*367b8279Smrg ‘--enable-logging’. In your code, replace the inclusion of ‘mpc.h’ 134*367b8279Smrg by ‘mpc-log.h’ and link the executable dynamically. Then all calls 135*367b8279Smrg to functions with only complex arguments are printed to ‘stderr’ in 136062d2d48Smrg the following form: First, the function name is given, followed by 137*367b8279Smrg its type such as ‘c_cc’, meaning that the function has one complex 138*367b8279Smrg result (one ‘c’ in front of the ‘_’), computed from two complex 139*367b8279Smrg arguments (two ‘c’ after the ‘_’). Then, the precisions of the 140062d2d48Smrg real and the imaginary part of the first result is given, followed 141062d2d48Smrg by the second one and so on. Finally, for each argument, the 142062d2d48Smrg precisions of its real and imaginary part are specified and the 143062d2d48Smrg argument itself is printed in hexadecimal via the function 144*367b8279Smrg ‘mpc_out_str’ (*note String and Stream Input and Output::). The 145062d2d48Smrg option requires a dynamic library, so it may not be combined with 146*367b8279Smrg ‘--disable-shared’. 1478fa80f29Smrg 148*367b8279Smrg Use ‘./configure --help’ for an exhaustive list of parameters. 1498fa80f29Smrg 150*367b8279Smrg 4. ‘make’ 1518fa80f29Smrg 1528fa80f29Smrg This compiles GNU MPC in the working directory. 1538fa80f29Smrg 154*367b8279Smrg 5. ‘make check’ 1558fa80f29Smrg 1568fa80f29Smrg This will make sure GNU MPC was built correctly. 1578fa80f29Smrg 1588fa80f29Smrg If you get error messages, please report them to 159*367b8279Smrg ‘mpc-discuss@inria.fr’ (*Note Reporting Bugs::, for information on 160*367b8279Smrg what to include in useful bug reports). 1618fa80f29Smrg 162*367b8279Smrg 6. ‘make install’ 1638fa80f29Smrg 164*367b8279Smrg This will copy the file ‘mpc.h’ to the directory 165*367b8279Smrg ‘/usr/local/include’, the file ‘libmpc.a’ to the directory 166*367b8279Smrg ‘/usr/local/lib’, and the file ‘mpc.info’ to the directory 167*367b8279Smrg ‘/usr/local/share/info’ (or if you passed the ‘--prefix’ option to 168*367b8279Smrg ‘configure’, using the prefix directory given as argument to 169*367b8279Smrg ‘--prefix’ instead of ‘/usr/local’). Note: you need write 1708fa80f29Smrg permissions on these directories. 1718fa80f29Smrg 172*367b8279Smrg2.1 Other ‘make’ Targets 1738fa80f29Smrg======================== 1748fa80f29Smrg 1758fa80f29SmrgThere are some other useful make targets: 1768fa80f29Smrg 177*367b8279Smrg • ‘info’ 1788fa80f29Smrg 179*367b8279Smrg Create an info version of the manual, in ‘mpc.info’. 1808fa80f29Smrg 181*367b8279Smrg • ‘pdf’ 1828fa80f29Smrg 183*367b8279Smrg Create a PDF version of the manual, in ‘doc/mpc.pdf’. 1848fa80f29Smrg 185*367b8279Smrg • ‘dvi’ 1868fa80f29Smrg 187*367b8279Smrg Create a DVI version of the manual, in ‘doc/mpc.dvi’. 1888fa80f29Smrg 189*367b8279Smrg • ‘ps’ 1908fa80f29Smrg 191*367b8279Smrg Create a Postscript version of the manual, in ‘doc/mpc.ps’. 1928fa80f29Smrg 193*367b8279Smrg • ‘html’ 1948fa80f29Smrg 1958fa80f29Smrg Create an HTML version of the manual, in several pages in the 196*367b8279Smrg directory ‘doc/mpc.html’; if you want only one output HTML file, 197*367b8279Smrg then type ‘makeinfo --html --no-split mpc.texi’ instead. 1988fa80f29Smrg 199*367b8279Smrg • ‘clean’ 2008fa80f29Smrg 2018fa80f29Smrg Delete all object files and archive files, but not the 2028fa80f29Smrg configuration files. 2038fa80f29Smrg 204*367b8279Smrg • ‘distclean’ 2058fa80f29Smrg 2068fa80f29Smrg Delete all files not included in the distribution. 2078fa80f29Smrg 208*367b8279Smrg • ‘uninstall’ 2098fa80f29Smrg 210*367b8279Smrg Delete all files copied by ‘make install’. 2118fa80f29Smrg 2128fa80f29Smrg2.2 Known Build Problems 2138fa80f29Smrg======================== 2148fa80f29Smrg 2158fa80f29SmrgOn AIX, if GMP was built with the 64-bit ABI, before building and 216*367b8279Smrgtesting GNU MPC, it might be necessary to set the ‘OBJECT_MODE’ 2178fa80f29Smrgenvironment variable to 64 by, e.g., 2188fa80f29Smrg 219*367b8279Smrg ‘export OBJECT_MODE=64’ 2208fa80f29Smrg 2218fa80f29Smrg This has been tested with the C compiler IBM XL C/C++ Enterprise 2228fa80f29SmrgEdition V8.0 for AIX, version: 08.00.0000.0021, GMP 4.2.4 and GNU MPFR 2238fa80f29Smrg2.4.1. 2248fa80f29Smrg 2258fa80f29Smrg Please report any other problems you encounter to 226*367b8279Smrg‘mpc-discuss@inria.fr’. *Note Reporting Bugs::. 2278fa80f29Smrg 2288fa80f29Smrg 2298fa80f29SmrgFile: mpc.info, Node: Reporting Bugs, Next: GNU MPC Basics, Prev: Installing GNU MPC, Up: Top 2308fa80f29Smrg 2318fa80f29Smrg3 Reporting Bugs 2328fa80f29Smrg**************** 2338fa80f29Smrg 2348fa80f29SmrgIf you think you have found a bug in the GNU MPC library, please 2358fa80f29Smrginvestigate and report it. We have made this library available to you, 2368fa80f29Smrgand it is not to ask too much from you, to ask you to report the bugs 2378fa80f29Smrgthat you find. 2388fa80f29Smrg 2398fa80f29Smrg There are a few things you should think about when you put your bug 2408fa80f29Smrgreport together. 2418fa80f29Smrg 2428fa80f29Smrg You have to send us a test case that makes it possible for us to 2438fa80f29Smrgreproduce the bug. Include instructions on how to run the test case. 2448fa80f29Smrg 245062d2d48Smrg You also have to explain what is wrong; if you get a crash, or if the 246062d2d48Smrgresults printed are incorrect and in that case, in what way. 2478fa80f29Smrg 248062d2d48Smrg Please include compiler version information in your bug report. This 249*367b8279Smrgcan be extracted using ‘gcc -v’, or ‘cc -V’ on some machines. Also, 250*367b8279Smrginclude the output from ‘uname -a’. 2518fa80f29Smrg 2528fa80f29Smrg If your bug report is good, we will do our best to help you to get a 253062d2d48Smrgcorrected version of the library; if the bug report is poor, we will not 254062d2d48Smrgdo anything about it (aside of chiding you to send better bug reports). 2558fa80f29Smrg 256*367b8279Smrg Send your bug report to: ‘mpc-discuss@inria.fr’. 2578fa80f29Smrg 2588fa80f29Smrg If you think something in this manual is unclear, or downright 2598fa80f29Smrgincorrect, or if the language needs to be improved, please send a note 2608fa80f29Smrgto the same address. 2618fa80f29Smrg 2628fa80f29Smrg 2638fa80f29SmrgFile: mpc.info, Node: GNU MPC Basics, Next: Complex Functions, Prev: Reporting Bugs, Up: Top 2648fa80f29Smrg 2658fa80f29Smrg4 GNU MPC Basics 2668fa80f29Smrg**************** 2678fa80f29Smrg 2688fa80f29SmrgAll declarations needed to use GNU MPC are collected in the include file 269*367b8279Smrg‘mpc.h’. It is designed to work with both C and C++ compilers. You 2708fa80f29Smrgshould include that file in any program using the GNU MPC library by 2718fa80f29Smrgadding the line 2728fa80f29Smrg #include "mpc.h" 2738fa80f29Smrg 2748fa80f29Smrg4.1 Nomenclature and Types 2758fa80f29Smrg========================== 2768fa80f29Smrg 277*367b8279Smrg“Complex number” or “Complex” for short, is a pair of two arbitrary 2788fa80f29Smrgprecision floating-point numbers (for the real and imaginary parts). 279*367b8279SmrgThe C data type for such objects is ‘mpc_t’. 2808fa80f29Smrg 281*367b8279SmrgThe “Precision” is the number of bits used to represent the mantissa of 2828fa80f29Smrgthe real and imaginary parts; the corresponding C data type is 283*367b8279Smrg‘mpfr_prec_t’. For more details on the allowed precision range, *note 284062d2d48Smrg(mpfr.info)Nomenclature and Types::. 2858fa80f29Smrg 286*367b8279SmrgThe “rounding mode” specifies the way to round the result of a complex 2878fa80f29Smrgoperation, in case the exact result can not be represented exactly in 288*367b8279Smrgthe destination mantissa; the corresponding C data type is ‘mpc_rnd_t’. 2898fa80f29SmrgA complex rounding mode is a pair of two rounding modes: one for the 2908fa80f29Smrgreal part, one for the imaginary part. 2918fa80f29Smrg 2928fa80f29Smrg4.2 Function Classes 2938fa80f29Smrg==================== 2948fa80f29Smrg 2958fa80f29SmrgThere is only one class of functions in the GNU MPC library, namely 296*367b8279Smrgfunctions for complex arithmetic. The function names begin with ‘mpc_’. 297*367b8279SmrgThe associated type is ‘mpc_t’. 2988fa80f29Smrg 2998fa80f29Smrg4.3 GNU MPC Variable Conventions 3008fa80f29Smrg================================ 3018fa80f29Smrg 3028fa80f29SmrgAs a general rule, all GNU MPC functions expect output arguments before 3038fa80f29Smrginput arguments. This notation is based on an analogy with the 3048fa80f29Smrgassignment operator. 3058fa80f29Smrg 306062d2d48Smrg GNU MPC allows you to use the same variable for both input and output 307062d2d48Smrgin the same expression. For example, the main function for 308*367b8279Smrgfloating-point multiplication, ‘mpc_mul’, can be used like this: 309*367b8279Smrg‘mpc_mul (x, x, x, rnd_mode)’. This computes the square of X with 310*367b8279Smrgrounding mode ‘rnd_mode’ and puts the result back in X. 3118fa80f29Smrg 31239f28e1eSmrg Before you can assign to an GNU MPC variable, you need to initialise 313062d2d48Smrgit by calling one of the special initialization functions. When you are 314062d2d48Smrgdone with a variable, you need to clear it out, using one of the 3158fa80f29Smrgfunctions for that purpose. 3168fa80f29Smrg 31739f28e1eSmrg A variable should only be initialised once, or at least cleared out 31839f28e1eSmrgbetween each initialization. After a variable has been initialised, it 3198fa80f29Smrgmay be assigned to any number of times. 3208fa80f29Smrg 32139f28e1eSmrg For efficiency reasons, avoid to initialise and clear out a variable 32239f28e1eSmrgin loops. Instead, initialise it before entering the loop, and clear it 323062d2d48Smrgout after the loop has exited. 3248fa80f29Smrg 325062d2d48Smrg You do not need to be concerned about allocating additional space for 326062d2d48SmrgGNU MPC variables, since each of its real and imaginary part has a 327062d2d48Smrgmantissa of fixed size. Hence unless you change its precision, or clear 32839f28e1eSmrgand reinitialise it, a complex variable will have the same allocated 329062d2d48Smrgspace during all its life. 3308fa80f29Smrg 3318fa80f29Smrg4.4 Rounding Modes 3328fa80f29Smrg================== 3338fa80f29Smrg 334*367b8279SmrgA complex rounding mode is of the form ‘MPC_RNDxy’ where ‘x’ and ‘y’ are 335*367b8279Smrgone of ‘N’ (to nearest), ‘Z’ (towards zero), ‘U’ (towards plus 336*367b8279Smrginfinity), ‘D’ (towards minus infinity), ‘A’ (away from zero, that is, 337*367b8279Smrgtowards plus or minus infinity depending on the sign of the number to be 338*367b8279Smrgrounded). The first letter refers to the rounding mode for the real 339*367b8279Smrgpart, and the second one for the imaginary part. For example 340*367b8279Smrg‘MPC_RNDZU’ indicates to round the real part towards zero, and the 341*367b8279Smrgimaginary part towards plus infinity. 3428fa80f29Smrg 343*367b8279Smrg The ‘round to nearest’ mode works as in the IEEE P754 standard: in 3448fa80f29Smrgcase the number to be rounded lies exactly in the middle of two 3458fa80f29Smrgrepresentable numbers, it is rounded to the one with the least 3468fa80f29Smrgsignificant bit set to zero. For example, the number 5, which is 3478fa80f29Smrgrepresented by (101) in binary, is rounded to (100)=4 with a precision 3488fa80f29Smrgof two bits, and not to (110)=6. 3498fa80f29Smrg 3508fa80f29Smrg4.5 Return Value 3518fa80f29Smrg================ 3528fa80f29Smrg 353*367b8279SmrgMost GNU MPC functions have a return value of type ‘int’, which is used 3548fa80f29Smrgto indicate the position of the rounded real and imaginary parts with 3558fa80f29Smrgrespect to the exact (infinite precision) values. If this integer is 356*367b8279Smrg‘i’, the macros ‘MPC_INEX_RE(i)’ and ‘MPC_INEX_IM(i)’ give 0 if the 3578fa80f29Smrgcorresponding rounded value is exact, a negative value if the rounded 3588fa80f29Smrgvalue is less than the exact one, and a positive value if it is greater 3598fa80f29Smrgthan the exact one. Similarly, functions computing a result of type 360*367b8279Smrg‘mpfr_t’ return an integer that is 0, positive or negative depending on 3618fa80f29Smrgwhether the rounded value is the same, larger or smaller then the exact 3628fa80f29Smrgresult. 3638fa80f29Smrg 364*367b8279Smrg Some functions, such as ‘mpc_sin_cos’, compute two complex results; 365*367b8279Smrgthe macros ‘MPC_INEX1(i)’ and ‘MPC_INEX2(i)’, applied to the return 366*367b8279Smrgvalue ‘i’ of such a function, yield the exactness value corresponding to 367062d2d48Smrgthe first or the second computed value, respectively. 3688fa80f29Smrg 3698fa80f29Smrg4.6 Branch Cuts And Special Values 3708fa80f29Smrg================================== 3718fa80f29Smrg 3728fa80f29SmrgSome complex functions have branch cuts, across which the function is 3738fa80f29Smrgdiscontinous. In GNU MPC, the branch cuts chosen are the same as those 3748fa80f29Smrgspecified for the corresponding functions in the ISO C99 standard. 3758fa80f29Smrg 3768fa80f29Smrg Likewise, when evaluated at a point whose real or imaginary part is 3778fa80f29Smrgeither infinite or a NaN or a signed zero, a function returns the same 3788fa80f29Smrgvalue as those specified for the corresponding function in the ISO C99 3798fa80f29Smrgstandard. 3808fa80f29Smrg 3818fa80f29Smrg 382*367b8279SmrgFile: mpc.info, Node: Complex Functions, Next: Ball Arithmetic, Prev: GNU MPC Basics, Up: Top 3838fa80f29Smrg 3848fa80f29Smrg5 Complex Functions 3858fa80f29Smrg******************* 3868fa80f29Smrg 387*367b8279SmrgThe complex functions expect arguments of type ‘mpc_t’. 3888fa80f29Smrg 3898fa80f29Smrg The GNU MPC floating-point functions have an interface that is 3908fa80f29Smrgsimilar to the GNU MP integer functions. The function prefix for 391*367b8279Smrgoperations on complex numbers is ‘mpc_’. 3928fa80f29Smrg 3938fa80f29Smrg The precision of a computation is defined as follows: Compute the 394*367b8279Smrgrequested operation exactly (with “infinite precision”), and round the 3958fa80f29Smrgresult to the destination variable precision with the given rounding 3968fa80f29Smrgmode. 3978fa80f29Smrg 3988fa80f29Smrg The GNU MPC complex functions are intended to be a smooth extension 3998fa80f29Smrgof the IEEE P754 arithmetic. The results obtained on one computer 4008fa80f29Smrgshould not differ from the results obtained on a computer with a 4018fa80f29Smrgdifferent word size. 4028fa80f29Smrg 4038fa80f29Smrg* Menu: 4048fa80f29Smrg 4058fa80f29Smrg* Initializing Complex Numbers:: 4068fa80f29Smrg* Assigning Complex Numbers:: 4078fa80f29Smrg* Converting Complex Numbers:: 4088fa80f29Smrg* String and Stream Input and Output:: 4098fa80f29Smrg* Complex Comparison:: 4108fa80f29Smrg* Projection & Decomposing:: 4118fa80f29Smrg* Basic Arithmetic:: 4128fa80f29Smrg* Power Functions and Logarithm:: 4138fa80f29Smrg* Trigonometric Functions:: 414*367b8279Smrg* Modular Functions:: 4158fa80f29Smrg* Miscellaneous Complex Functions:: 4168fa80f29Smrg* Advanced Functions:: 4178fa80f29Smrg* Internals:: 4188fa80f29Smrg 4198fa80f29Smrg 4208fa80f29SmrgFile: mpc.info, Node: Initializing Complex Numbers, Next: Assigning Complex Numbers, Up: Complex Functions 4218fa80f29Smrg 4228fa80f29Smrg5.1 Initialization Functions 4238fa80f29Smrg============================ 4248fa80f29Smrg 425*367b8279SmrgAn ‘mpc_t’ object must be initialised before storing the first value in 426*367b8279Smrgit. The functions ‘mpc_init2’ and ‘mpc_init3’ are used for that 4278fa80f29Smrgpurpose. 4288fa80f29Smrg 4298fa80f29Smrg -- Function: void mpc_init2 (mpc_t Z, mpfr_prec_t PREC) 43039f28e1eSmrg Initialise Z to precision PREC bits and set its real and imaginary 43139f28e1eSmrg parts to NaN. Normally, a variable should be initialised once only 432*367b8279Smrg or at least be cleared, using ‘mpc_clear’, between initializations. 4338fa80f29Smrg 4348fa80f29Smrg -- Function: void mpc_init3 (mpc_t Z, mpfr_prec_t PREC_R, mpfr_prec_t 4358fa80f29Smrg PREC_I) 43639f28e1eSmrg Initialise Z with the precision of its real part being PREC_R bits 4378fa80f29Smrg and the precision of its imaginary part being PREC_I bits, and set 4388fa80f29Smrg the real and imaginary parts to NaN. 4398fa80f29Smrg 4408fa80f29Smrg -- Function: void mpc_clear (mpc_t Z) 4418fa80f29Smrg Free the space occupied by Z. Make sure to call this function for 442*367b8279Smrg all ‘mpc_t’ variables when you are done with them. 4438fa80f29Smrg 44439f28e1eSmrg Here is an example on how to initialise complex variables: 4458fa80f29Smrg { 4468fa80f29Smrg mpc_t x, y; 4478fa80f29Smrg mpc_init2 (x, 256); /* precision _exactly_ 256 bits */ 4488fa80f29Smrg mpc_init3 (y, 100, 50); /* 100/50 bits for the real/imaginary part */ 4498fa80f29Smrg ... 4508fa80f29Smrg mpc_clear (x); 4518fa80f29Smrg mpc_clear (y); 4528fa80f29Smrg } 4538fa80f29Smrg 4548fa80f29Smrg The following function is useful for changing the precision during a 4558fa80f29Smrgcalculation. A typical use would be for adjusting the precision 4568fa80f29Smrggradually in iterative algorithms like Newton-Raphson, making the 4578fa80f29Smrgcomputation precision closely match the actual accurate part of the 4588fa80f29Smrgnumbers. 4598fa80f29Smrg 4608fa80f29Smrg -- Function: void mpc_set_prec (mpc_t X, mpfr_prec_t PREC) 4618fa80f29Smrg Reset the precision of X to be *exactly* PREC bits, and set its 4628fa80f29Smrg real/imaginary parts to NaN. The previous value stored in X is 463*367b8279Smrg lost. It is equivalent to a call to ‘mpc_clear(x)’ followed by a 464*367b8279Smrg call to ‘mpc_init2(x, prec)’, but more efficient as no allocation 4658fa80f29Smrg is done in case the current allocated space for the mantissa of X 4668fa80f29Smrg is sufficient. 4678fa80f29Smrg 468a0d373eeSmrg -- Function: mpfr_prec_t mpc_get_prec (const mpc_t X) 4698fa80f29Smrg If the real and imaginary part of X have the same precision, it is 4708fa80f29Smrg returned, otherwise, 0 is returned. 4718fa80f29Smrg 4728fa80f29Smrg -- Function: void mpc_get_prec2 (mpfr_prec_t* PR, mpfr_prec_t* PI, 473a0d373eeSmrg const mpc_t X) 4748fa80f29Smrg Returns the precision of the real part of X via PR and of its 4758fa80f29Smrg imaginary part via PI. 4768fa80f29Smrg 4778fa80f29Smrg 4788fa80f29SmrgFile: mpc.info, Node: Assigning Complex Numbers, Next: Converting Complex Numbers, Prev: Initializing Complex Numbers, Up: Complex Functions 4798fa80f29Smrg 4808fa80f29Smrg5.2 Assignment Functions 4818fa80f29Smrg======================== 4828fa80f29Smrg 48339f28e1eSmrgThese functions assign new values to already initialised complex numbers 4848fa80f29Smrg(*note Initializing Complex Numbers::). When using any functions with 485*367b8279Smrg‘intmax_t’ or ‘uintmax_t’ parameters, you must include ‘<stdint.h>’ or 486*367b8279Smrg‘<inttypes.h>’ _before_ ‘mpc.h’, to allow ‘mpc.h’ to define prototypes 4878fa80f29Smrgfor these functions. Similarly, functions with parameters of type 488*367b8279Smrg‘complex’ or ‘long complex’ are defined only if ‘<complex.h>’ is 489*367b8279Smrgincluded _before_ ‘mpc.h’. If you need assignment functions that are 490*367b8279Smrgnot in the current API, you can define them using the ‘MPC_SET_X_Y’ 4918fa80f29Smrgmacro (*note Advanced Functions::). 4928fa80f29Smrg 493a0d373eeSmrg -- Function: int mpc_set (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 4948fa80f29Smrg Set the value of ROP from OP, rounded to the precision of ROP with 4958fa80f29Smrg the given rounding mode RND. 4968fa80f29Smrg 497062d2d48Smrg -- Function: int mpc_set_ui (mpc_t ROP, unsigned long int OP, mpc_rnd_t 498062d2d48Smrg RND) 4998fa80f29Smrg -- Function: int mpc_set_si (mpc_t ROP, long int OP, mpc_rnd_t RND) 5008fa80f29Smrg -- Function: int mpc_set_uj (mpc_t ROP, uintmax_t OP, mpc_rnd_t RND) 5018fa80f29Smrg -- Function: int mpc_set_sj (mpc_t ROP, intmax_t OP, mpc_rnd_t RND) 5028fa80f29Smrg -- Function: int mpc_set_d (mpc_t ROP, double OP, mpc_rnd_t RND) 5038fa80f29Smrg -- Function: int mpc_set_ld (mpc_t ROP, long double OP, mpc_rnd_t RND) 5048fa80f29Smrg -- Function: int mpc_set_dc (mpc_t ROP, double _Complex OP, mpc_rnd_t 5058fa80f29Smrg RND) 5068fa80f29Smrg -- Function: int mpc_set_ldc (mpc_t ROP, long double _Complex OP, 5078fa80f29Smrg mpc_rnd_t RND) 508a0d373eeSmrg -- Function: int mpc_set_z (mpc_t ROP, const mpz_t OP mpc_rnd_t RND) 509a0d373eeSmrg -- Function: int mpc_set_q (mpc_t ROP, const mpq_t OP mpc_rnd_t RND) 510a0d373eeSmrg -- Function: int mpc_set_f (mpc_t ROP, const mpf_t OP mpc_rnd_t RND) 511a0d373eeSmrg -- Function: int mpc_set_fr (mpc_t ROP, const mpfr_t OP, mpc_rnd_t RND) 5128fa80f29Smrg Set the value of ROP from OP, rounded to the precision of ROP with 5138fa80f29Smrg the given rounding mode RND. The argument OP is interpreted as 5148fa80f29Smrg real, so the imaginary part of ROP is set to zero with a positive 515*367b8279Smrg sign. Please note that even a ‘long int’ may have to be rounded, 5168fa80f29Smrg if the destination precision is less than the machine word width. 517*367b8279Smrg For ‘mpc_set_d’, be careful that the input number OP may not be 5188fa80f29Smrg exactly representable as a double-precision number (this happens 5198fa80f29Smrg for 0.1 for instance), in which case it is first rounded by the C 5208fa80f29Smrg compiler to a double-precision number, and then only to a complex 5218fa80f29Smrg number. 5228fa80f29Smrg 5238fa80f29Smrg -- Function: int mpc_set_ui_ui (mpc_t ROP, unsigned long int OP1, 5248fa80f29Smrg unsigned long int OP2, mpc_rnd_t RND) 5258fa80f29Smrg -- Function: int mpc_set_si_si (mpc_t ROP, long int OP1, long int OP2, 5268fa80f29Smrg mpc_rnd_t RND) 5278fa80f29Smrg -- Function: int mpc_set_uj_uj (mpc_t ROP, uintmax_t OP1, uintmax_t 5288fa80f29Smrg OP2, mpc_rnd_t RND) 5298fa80f29Smrg -- Function: int mpc_set_sj_sj (mpc_t ROP, intmax_t OP1, intmax_t OP2, 5308fa80f29Smrg mpc_rnd_t RND) 5318fa80f29Smrg -- Function: int mpc_set_d_d (mpc_t ROP, double OP1, double OP2, 5328fa80f29Smrg mpc_rnd_t RND) 533062d2d48Smrg -- Function: int mpc_set_ld_ld (mpc_t ROP, long double OP1, long double 534062d2d48Smrg OP2, mpc_rnd_t RND) 535a0d373eeSmrg -- Function: int mpc_set_z_z (mpc_t ROP, const mpz_t OP1, const mpz_t 536a0d373eeSmrg OP2, mpc_rnd_t RND) 537a0d373eeSmrg -- Function: int mpc_set_q_q (mpc_t ROP, const mpq_t OP1, const mpq_t 538a0d373eeSmrg OP2, mpc_rnd_t RND) 539a0d373eeSmrg -- Function: int mpc_set_f_f (mpc_t ROP, const mpf_t OP1, const mpf_t 540a0d373eeSmrg OP2, mpc_rnd_t RND) 541a0d373eeSmrg -- Function: int mpc_set_fr_fr (mpc_t ROP, const mpfr_t OP1, const 542a0d373eeSmrg mpfr_t OP2, mpc_rnd_t RND) 543062d2d48Smrg Set the real part of ROP from OP1, and its imaginary part from OP2, 544062d2d48Smrg according to the rounding mode RND. 5458fa80f29Smrg 546*367b8279Smrg Beware that the behaviour of ‘mpc_set_fr_fr’ is undefined if OP1 or 547062d2d48Smrg OP2 is a pointer to the real or imaginary part of ROP. To exchange 548062d2d48Smrg the real and the imaginary part of a complex number, either use 549*367b8279Smrg ‘mpfr_swap (mpc_realref (rop), mpc_imagref (rop))’, which also 550062d2d48Smrg exchanges the precisions of the two parts; or use a temporary 551062d2d48Smrg variable. 5528fa80f29Smrg 5538fa80f29Smrg For functions assigning complex variables from strings or input 5548fa80f29Smrgstreams, *note String and Stream Input and Output::. 5558fa80f29Smrg 5568fa80f29Smrg -- Function: void mpc_set_nan (mpc_t ROP) 5578fa80f29Smrg Set ROP to Nan+i*NaN. 5588fa80f29Smrg 5598fa80f29Smrg -- Function: void mpc_swap (mpc_t OP1, mpc_t OP2) 5608fa80f29Smrg Swap the values of OP1 and OP2 efficiently. Warning: The 5618fa80f29Smrg precisions are exchanged, too; in case these are different, 562*367b8279Smrg ‘mpc_swap’ is thus not equivalent to three ‘mpc_set’ calls using a 5638fa80f29Smrg third auxiliary variable. 5648fa80f29Smrg 5658fa80f29Smrg 5668fa80f29SmrgFile: mpc.info, Node: Converting Complex Numbers, Next: String and Stream Input and Output, Prev: Assigning Complex Numbers, Up: Complex Functions 5678fa80f29Smrg 5688fa80f29Smrg5.3 Conversion Functions 5698fa80f29Smrg======================== 5708fa80f29Smrg 571*367b8279SmrgThe following functions are available only if ‘<complex.h>’ is included 572*367b8279Smrg_before_ ‘mpc.h’. 5738fa80f29Smrg 574a0d373eeSmrg -- Function: double _Complex mpc_get_dc (const mpc_t OP, mpc_rnd_t RND) 5758fa80f29Smrg -- Function: long double _Complex mpc_get_ldc (mpc_t OP, mpc_rnd_t RND) 5768fa80f29Smrg Convert OP to a C complex number, using the rounding mode RND. 5778fa80f29Smrg 5788fa80f29Smrg For functions converting complex variables to strings or stream 5798fa80f29Smrgoutput, *note String and Stream Input and Output::. 5808fa80f29Smrg 5818fa80f29Smrg 5828fa80f29SmrgFile: mpc.info, Node: String and Stream Input and Output, Next: Complex Comparison, Prev: Converting Complex Numbers, Up: Complex Functions 5838fa80f29Smrg 5848fa80f29Smrg5.4 String and Stream Input and Output 5858fa80f29Smrg====================================== 5868fa80f29Smrg 5878fa80f29Smrg -- Function: int mpc_strtoc (mpc_t ROP, const char *NPTR, char 5888fa80f29Smrg **ENDPTR, int BASE, mpc_rnd_t RND) 5898fa80f29Smrg Read a complex number from a string NPTR in base BASE, rounded to 5908fa80f29Smrg the precision of ROP with the given rounding mode RND. The BASE 5918fa80f29Smrg must be either 0 or a number from 2 to 36 (otherwise the behaviour 5928fa80f29Smrg is undefined). If NPTR starts with valid data, the result is 5938fa80f29Smrg stored in ROP, the usual inexact value is returned (*note Return 5948fa80f29Smrg Value: return-value.) and, if ENDPTR is not the null pointer, 5958fa80f29Smrg *ENDPTR points to the character just after the valid data. 596*367b8279Smrg Otherwise, ROP is set to ‘NaN + i * NaN’, -1 is returned and, if 5978fa80f29Smrg ENDPTR is not the null pointer, the value of NPTR is stored in the 5988fa80f29Smrg location referenced by ENDPTR. 5998fa80f29Smrg 6008fa80f29Smrg The expected form of a complex number string is either a real 6018fa80f29Smrg number (an optional leading whitespace, an optional sign followed 6028fa80f29Smrg by a floating-point number), or a pair of real numbers in 6038fa80f29Smrg parentheses separated by whitespace. If a real number is read, the 6048fa80f29Smrg missing imaginary part is set to +0. The form of a floating-point 605062d2d48Smrg number depends on the base and is described in the documentation of 606*367b8279Smrg ‘mpfr_strtofr’ (*note (mpfr.info)Assignment Functions::). For 607*367b8279Smrg instance, ‘"3.1415926"’, ‘"(1.25e+7 +.17)"’, ‘"(@nan@ 2)"’ and 608*367b8279Smrg ‘"(-0 -7)"’ are valid strings for BASE = 10. If BASE = 0, then a 609062d2d48Smrg prefix may be used to indicate the base in which the floating-point 610*367b8279Smrg number is written. Use prefix ’0b’ for binary numbers, prefix ’0x’ 611062d2d48Smrg for hexadecimal numbers, and no prefix for decimal numbers. The 612062d2d48Smrg real and imaginary part may then be written in different bases. 613*367b8279Smrg For instance, ‘"(1.024e+3 +2.05e+3)"’ and ‘"(0b1p+10 +0x802)"’ are 614*367b8279Smrg valid strings for ‘base’=0 and represent the same value. 6158fa80f29Smrg 6168fa80f29Smrg -- Function: int mpc_set_str (mpc_t ROP, const char *S, int BASE, 6178fa80f29Smrg mpc_rnd_t rnd) 6188fa80f29Smrg Set ROP to the value of the string S in base BASE, rounded to the 6198fa80f29Smrg precision of ROP with the given rounding mode RND. See the 620*367b8279Smrg documentation of ‘mpc_strtoc’ for a detailed description of the 621*367b8279Smrg valid string formats. Contrarily to ‘mpc_strtoc’, ‘mpc_set_str’ 6228fa80f29Smrg requires the _whole_ string to represent a valid complex number 6238fa80f29Smrg (potentially followed by additional white space). This function 624062d2d48Smrg returns the usual inexact value (*note Return Value: return-value.) 625062d2d48Smrg if the entire string up to the final null character is a valid 626*367b8279Smrg number in base BASE; otherwise it returns −1, and ROP is set to 627062d2d48Smrg NaN+i*NaN. 6288fa80f29Smrg 629a0d373eeSmrg -- Function: char * mpc_get_str (int B, size_t N, const mpc_t OP, 630a0d373eeSmrg mpc_rnd_t RND) 6318fa80f29Smrg Convert OP to a string containing its real and imaginary parts, 6328fa80f29Smrg separated by a space and enclosed in a pair of parentheses. The 6338fa80f29Smrg numbers are written in base B (which may vary from 2 to 36) and 6348fa80f29Smrg rounded according to RND. The number of significant digits, at 6358fa80f29Smrg least 2, is given by N. It is also possible to let N be zero, in 6368fa80f29Smrg which case the number of digits is chosen large enough so that 637062d2d48Smrg re-reading the printed value with the same precision, assuming both 638062d2d48Smrg output and input use rounding to nearest, will recover the original 639*367b8279Smrg value of OP. Note that ‘mpc_get_str’ uses the decimal point of the 640*367b8279Smrg current locale if available, and ‘.’ otherwise. 6418fa80f29Smrg 6428fa80f29Smrg The string is generated using the current memory allocation 643*367b8279Smrg function (‘malloc’ by default, unless it has been modified using 644*367b8279Smrg the custom memory allocation interface of ‘gmp’); once it is not 645*367b8279Smrg needed any more, it should be freed by calling ‘mpc_free_str’. 6468fa80f29Smrg 6478fa80f29Smrg -- Function: void mpc_free_str (char *STR) 6488fa80f29Smrg Free the string STR, which needs to have been allocated by a call 649*367b8279Smrg to ‘mpc_get_str’. 6508fa80f29Smrg 6518fa80f29Smrg The following two functions read numbers from input streams and write 6528fa80f29Smrgthem to output streams. When using any of these functions, you need to 653*367b8279Smrginclude ‘stdio.h’ _before_ ‘mpc.h’. 6548fa80f29Smrg 6558fa80f29Smrg -- Function: int mpc_inp_str (mpc_t ROP, FILE *STREAM, size_t *READ, 6568fa80f29Smrg int BASE, mpc_rnd_t RND) 657*367b8279Smrg Input a string in base BASE in the same format as for ‘mpc_strtoc’ 6588fa80f29Smrg from stdio stream STREAM, rounded according to RND, and put the 6598fa80f29Smrg read complex number into ROP. If STREAM is the null pointer, ROP 660*367b8279Smrg is read from ‘stdin’. Return the usual inexact value; if an error 661*367b8279Smrg occurs, set ROP to ‘NaN + i * NaN’ and return -1. If READ is not 6628fa80f29Smrg the null pointer, it is set to the number of read characters. 6638fa80f29Smrg 664*367b8279Smrg Unlike ‘mpc_strtoc’, the function ‘mpc_inp_str’ does not possess 6658fa80f29Smrg perfect knowledge of the string to transform and has to read it 6668fa80f29Smrg character by character, so it behaves slightly differently: It 6678fa80f29Smrg tries to read a string describing a complex number and processes 668*367b8279Smrg this string through a call to ‘mpc_set_str’. Precisely, after 669062d2d48Smrg skipping optional whitespace, a minimal string is read according to 670*367b8279Smrg the regular expression ‘mpfr | '(' \s* mpfr \s+ mpfr \s* ')'’, 671*367b8279Smrg where ‘\s’ denotes a whitespace, and ‘mpfr’ is either a string 6728fa80f29Smrg containing neither whitespaces nor parentheses, or 673*367b8279Smrg ‘nan(n-char-sequence)’ or ‘@nan@(n-char-sequence)’ (regardless of 674*367b8279Smrg capitalisation) with ‘n-char-sequence’ a string of ascii letters, 675*367b8279Smrg digits or ‘'_'’. 6768fa80f29Smrg 677*367b8279Smrg For instance, upon input of ‘"nan(13 1)"’, the function 678*367b8279Smrg ‘mpc_inp_str’ starts to recognise a value of NaN followed by an 6798fa80f29Smrg n-char-sequence indicated by the opening parenthesis; as soon as 68039f28e1eSmrg the space is reached, it becomes clear that the expression in 6818fa80f29Smrg parentheses is not an n-char-sequence, and the error flag -1 is 682062d2d48Smrg returned after 6 characters have been consumed from the stream (the 683062d2d48Smrg whitespace itself remaining in the stream). The function 684*367b8279Smrg ‘mpc_strtoc’, on the other hand, may track back when reaching the 6858fa80f29Smrg whitespace; it treats the string as the two successive complex 686*367b8279Smrg numbers ‘NaN + i * 0’ and ‘13 + i’. It is thus recommended to have 687062d2d48Smrg a whitespace follow each floating point number to avoid this 6888fa80f29Smrg problem. 6898fa80f29Smrg 6908fa80f29Smrg -- Function: size_t mpc_out_str (FILE *STREAM, int BASE, size_t 691a0d373eeSmrg N_DIGITS, const mpc_t OP, mpc_rnd_t RND) 692062d2d48Smrg Output OP on stdio stream STREAM in base BASE, rounded according to 693*367b8279Smrg RND, in the same format as for ‘mpc_strtoc’ If STREAM is the null 694*367b8279Smrg pointer, ROP is written to ‘stdout’. 6958fa80f29Smrg 6968fa80f29Smrg Return the number of characters written. 6978fa80f29Smrg 6988fa80f29Smrg 6998fa80f29SmrgFile: mpc.info, Node: Complex Comparison, Next: Projection & Decomposing, Prev: String and Stream Input and Output, Up: Complex Functions 7008fa80f29Smrg 7018fa80f29Smrg5.5 Comparison Functions 7028fa80f29Smrg======================== 7038fa80f29Smrg 704a0d373eeSmrg -- Function: int mpc_cmp (const mpc_t OP1, const mpc_t OP2) 705a0d373eeSmrg -- Function: int mpc_cmp_si_si (const mpc_t OP1, long int OP2R, long 706a0d373eeSmrg int OP2I) 7078fa80f29Smrg -- Macro: int mpc_cmp_si (mpc_t OP1, long int OP2) 708062d2d48Smrg 709*367b8279Smrg Compare OP1 and OP2, where in the case of ‘mpc_cmp_si_si’, OP2 is 7108fa80f29Smrg taken to be OP2R + i OP2I. The return value C can be decomposed 711*367b8279Smrg into ‘x = MPC_INEX_RE(c)’ and ‘y = MPC_INEX_IM(c)’, such that X is 7128fa80f29Smrg positive if the real part of OP1 is greater than that of OP2, zero 7138fa80f29Smrg if both real parts are equal, and negative if the real part of OP1 714062d2d48Smrg is less than that of OP2, and likewise for Y. Both OP1 and OP2 are 715062d2d48Smrg considered to their full own precision, which may differ. It is 716062d2d48Smrg not allowed that one of the operands has a NaN (Not-a-Number) part. 7178fa80f29Smrg 718062d2d48Smrg The storage of the return value is such that equality can be simply 719*367b8279Smrg checked with ‘mpc_cmp (op1, op2) == 0’. 7208fa80f29Smrg 721a0d373eeSmrg -- Function: int mpc_cmp_abs (const mpc_t OP1, const mpc_t OP2) 72239f28e1eSmrg 72339f28e1eSmrg Compare the absolute values of OP1 and OP2. The return value is 0 72439f28e1eSmrg if both are the same (including infinity), positive if the absolute 72539f28e1eSmrg value of OP1 is greater than that of OP2, and negative if it is 72639f28e1eSmrg smaller. If OP1 or OP2 has a real or imaginary part which is NaN, 727*367b8279Smrg the function behaves like ‘mpfr_cmp’ on two real numbers of which 72839f28e1eSmrg at least one is NaN. 72939f28e1eSmrg 7308fa80f29Smrg 7318fa80f29SmrgFile: mpc.info, Node: Projection & Decomposing, Next: Basic Arithmetic, Prev: Complex Comparison, Up: Complex Functions 7328fa80f29Smrg 7338fa80f29Smrg5.6 Projection and Decomposing Functions 7348fa80f29Smrg======================================== 7358fa80f29Smrg 736a0d373eeSmrg -- Function: int mpc_real (mpfr_t ROP, const mpc_t OP, mpfr_rnd_t RND) 7378fa80f29Smrg Set ROP to the value of the real part of OP rounded in the 7388fa80f29Smrg direction RND. 7398fa80f29Smrg 740a0d373eeSmrg -- Function: int mpc_imag (mpfr_t ROP, const mpc_t OP, mpfr_rnd_t RND) 7418fa80f29Smrg Set ROP to the value of the imaginary part of OP rounded in the 7428fa80f29Smrg direction RND. 7438fa80f29Smrg 7448fa80f29Smrg -- Macro: mpfr_t mpc_realref (mpc_t OP) 7458fa80f29Smrg -- Macro: mpfr_t mpc_imagref (mpc_t OP) 7468fa80f29Smrg Return a reference to the real part and imaginary part of OP, 747*367b8279Smrg respectively. The ‘mpfr’ functions can be used on the result of 748*367b8279Smrg these macros (note that the ‘mpfr_t’ type is itself a pointer). 7498fa80f29Smrg 750a0d373eeSmrg -- Function: int mpc_arg (mpfr_t ROP, const mpc_t OP, mpfr_rnd_t RND) 751062d2d48Smrg Set ROP to the argument of OP, with a branch cut along the negative 752062d2d48Smrg real axis. 7538fa80f29Smrg 754a0d373eeSmrg -- Function: int mpc_proj (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 7558fa80f29Smrg Compute a projection of OP onto the Riemann sphere. Set ROP to OP 7568fa80f29Smrg rounded in the direction RND, except when at least one part of OP 7578fa80f29Smrg is infinite (even if the other part is a NaN) in which case the 7588fa80f29Smrg real part of ROP is set to plus infinity and its imaginary part to 7598fa80f29Smrg a signed zero with the same sign as the imaginary part of OP. 7608fa80f29Smrg 7618fa80f29Smrg 7628fa80f29SmrgFile: mpc.info, Node: Basic Arithmetic, Next: Power Functions and Logarithm, Prev: Projection & Decomposing, Up: Complex Functions 7638fa80f29Smrg 7648fa80f29Smrg5.7 Basic Arithmetic Functions 7658fa80f29Smrg============================== 7668fa80f29Smrg 7678fa80f29SmrgAll the following functions are designed in such a way that, when 7688fa80f29Smrgworking with real numbers instead of complex numbers, their complexity 769062d2d48Smrgshould essentially be the same as with the GNU MPFR library, with only a 770062d2d48Smrgmarginal overhead due to the GNU MPC layer. 7718fa80f29Smrg 772*367b8279Smrg For functions taking as input an integer argument (for example 773*367b8279Smrg‘mpc_add_ui’), when this argument is zero, it is considered as an 774*367b8279Smrgunsigned (that is, exact in this context) zero, and we follow the MPFR 775*367b8279Smrgconventions: (0) + (+0) = +0, (0) - (+0) = -0, (0) - (+0) = -0, (0) - 776*367b8279Smrg(-0) = +0. The same applies for functions taking an argument of type 777*367b8279Smrg‘mpfr_t’, such as ‘mpc_add_fr’, of which the imaginary part is 778*367b8279Smrgconsidered to be an exact, unsigned zero. 779*367b8279Smrg 780a0d373eeSmrg -- Function: int mpc_add (mpc_t ROP, const mpc_t OP1, const mpc_t OP2, 7818fa80f29Smrg mpc_rnd_t RND) 782a0d373eeSmrg -- Function: int mpc_add_ui (mpc_t ROP, const mpc_t OP1, unsigned long 783a0d373eeSmrg int OP2, mpc_rnd_t RND) 784a0d373eeSmrg -- Function: int mpc_add_fr (mpc_t ROP, const mpc_t OP1, const mpfr_t 785a0d373eeSmrg OP2, mpc_rnd_t RND) 7868fa80f29Smrg Set ROP to OP1 + OP2 rounded according to RND. 7878fa80f29Smrg 788a0d373eeSmrg -- Function: int mpc_sub (mpc_t ROP, const mpc_t OP1, const mpc_t OP2, 7898fa80f29Smrg mpc_rnd_t RND) 790a0d373eeSmrg -- Function: int mpc_sub_fr (mpc_t ROP, const mpc_t OP1, const mpfr_t 7918fa80f29Smrg OP2, mpc_rnd_t RND) 792a0d373eeSmrg -- Function: int mpc_fr_sub (mpc_t ROP, const mpfr_t OP1, const mpc_t 793a0d373eeSmrg OP2, mpc_rnd_t RND) 794a0d373eeSmrg -- Function: int mpc_sub_ui (mpc_t ROP, const mpc_t OP1, unsigned long 795a0d373eeSmrg int OP2, mpc_rnd_t RND) 796a0d373eeSmrg -- Macro: int mpc_ui_sub (mpc_t ROP, unsigned long int OP1, const mpc_t 797a0d373eeSmrg OP2, mpc_rnd_t RND) 7988fa80f29Smrg -- Function: int mpc_ui_ui_sub (mpc_t ROP, unsigned long int RE1, 7998fa80f29Smrg unsigned long int IM1, mpc_t OP2, mpc_rnd_t RND) 800*367b8279Smrg Set ROP to OP1 − OP2 rounded according to RND. For 801*367b8279Smrg ‘mpc_ui_ui_sub’, OP1 is RE1 + IM1. 8028fa80f29Smrg 803a0d373eeSmrg -- Function: int mpc_neg (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 804*367b8279Smrg Set ROP to −OP rounded according to RND. Just changes the sign if 8058fa80f29Smrg ROP and OP are the same variable. 8068fa80f29Smrg 807a0d373eeSmrg -- Function: int mpc_sum (mpc_t ROP, const mpc_ptr* OP, unsigned long 808a0d373eeSmrg N, mpc_rnd_t RND) 80990a8ff21Smrg Set ROP to the sum of the elements in the array OP of length N, 81090a8ff21Smrg rounded according to RND. 81190a8ff21Smrg 812a0d373eeSmrg -- Function: int mpc_mul (mpc_t ROP, const mpc_t OP1, const mpc_t OP2, 813a0d373eeSmrg mpc_rnd_t RND) 814a0d373eeSmrg -- Function: int mpc_mul_ui (mpc_t ROP, const mpc_t OP1, unsigned long 815a0d373eeSmrg int OP2, mpc_rnd_t RND) 816a0d373eeSmrg -- Function: int mpc_mul_si (mpc_t ROP, const mpc_t OP1, long int OP2, 817a0d373eeSmrg mpc_rnd_t RND) 818a0d373eeSmrg -- Function: int mpc_mul_fr (mpc_t ROP, const mpc_t OP1, const mpfr_t 8198fa80f29Smrg OP2, mpc_rnd_t RND) 8208fa80f29Smrg Set ROP to OP1 times OP2 rounded according to RND. Note: for 821*367b8279Smrg ‘mpc_mul’, in case OP1 and OP2 have the same value, use ‘mpc_sqr’ 8228fa80f29Smrg for better efficiency. 8238fa80f29Smrg 824a0d373eeSmrg -- Function: int mpc_mul_i (mpc_t ROP, const mpc_t OP, int SGN, 825a0d373eeSmrg mpc_rnd_t RND) 8268fa80f29Smrg Set ROP to OP times the imaginary unit i if SGN is non-negative, 8278fa80f29Smrg set ROP to OP times -i otherwise, in both cases rounded according 8288fa80f29Smrg to RND. 8298fa80f29Smrg 830a0d373eeSmrg -- Function: int mpc_sqr (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 8318fa80f29Smrg Set ROP to the square of OP rounded according to RND. 8328fa80f29Smrg 833a0d373eeSmrg -- Function: int mpc_fma (mpc_t ROP, const mpc_t OP1, const mpc_t OP2, 834a0d373eeSmrg const mpc_t OP3, mpc_rnd_t RND) 8358fa80f29Smrg Set ROP to OP1*OP2+OP3, rounded according to RND, with only one 8368fa80f29Smrg final rounding. 8378fa80f29Smrg 838a0d373eeSmrg -- Function: int mpc_dot (mpc_t ROP, const mpc_ptr* OP1, mpc_ptr* OP2, 83990a8ff21Smrg unsigned long N, mpc_rnd_t RND) 84090a8ff21Smrg Set ROP to the dot product of the elements in the arrays OP1 and 84190a8ff21Smrg OP2, both of length N, rounded according to RND. 84290a8ff21Smrg 843a0d373eeSmrg -- Function: int mpc_div (mpc_t ROP, const mpc_t OP1, const mpc_t OP2, 8448fa80f29Smrg mpc_rnd_t RND) 845a0d373eeSmrg -- Function: int mpc_div_ui (mpc_t ROP, const mpc_t OP1, unsigned long 846a0d373eeSmrg int OP2, mpc_rnd_t RND) 847a0d373eeSmrg -- Function: int mpc_div_fr (mpc_t ROP, const mpc_t OP1, const mpfr_t 8488fa80f29Smrg OP2, mpc_rnd_t RND) 849a0d373eeSmrg -- Function: int mpc_ui_div (mpc_t ROP, unsigned long int OP1, const 850a0d373eeSmrg mpc_t OP2, mpc_rnd_t RND) 851a0d373eeSmrg -- Function: int mpc_fr_div (mpc_t ROP, const mpfr_t OP1, const mpc_t 852a0d373eeSmrg OP2, mpc_rnd_t RND) 8538fa80f29Smrg Set ROP to OP1/OP2 rounded according to RND. 8548fa80f29Smrg 855a0d373eeSmrg -- Function: int mpc_conj (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 8568fa80f29Smrg Set ROP to the conjugate of OP rounded according to RND. Just 8578fa80f29Smrg changes the sign of the imaginary part if ROP and OP are the same 8588fa80f29Smrg variable. 8598fa80f29Smrg 860a0d373eeSmrg -- Function: int mpc_abs (mpfr_t ROP, const mpc_t OP, mpfr_rnd_t RND) 8618fa80f29Smrg Set the floating-point number ROP to the absolute value of OP, 8628fa80f29Smrg rounded in the direction RND. 8638fa80f29Smrg 864a0d373eeSmrg -- Function: int mpc_norm (mpfr_t ROP, const mpc_t OP, mpfr_rnd_t RND) 8658fa80f29Smrg Set the floating-point number ROP to the norm of OP (i.e., the 8668fa80f29Smrg square of its absolute value), rounded in the direction RND. 8678fa80f29Smrg 868a0d373eeSmrg -- Function: int mpc_mul_2ui (mpc_t ROP, const mpc_t OP1, unsigned long 869a0d373eeSmrg int OP2, mpc_rnd_t RND) 870a0d373eeSmrg -- Function: int mpc_mul_2si (mpc_t ROP, const mpc_t OP1, long int OP2, 8718fa80f29Smrg mpc_rnd_t RND) 8728fa80f29Smrg Set ROP to OP1 times 2 raised to OP2 rounded according to RND. 8738fa80f29Smrg Just modifies the exponents of the real and imaginary parts by OP2 8748fa80f29Smrg when ROP and OP1 are identical. 8758fa80f29Smrg 876a0d373eeSmrg -- Function: int mpc_div_2ui (mpc_t ROP, const mpc_t OP1, unsigned long 877a0d373eeSmrg int OP2, mpc_rnd_t RND) 878a0d373eeSmrg -- Function: int mpc_div_2si (mpc_t ROP, const mpc_t OP1, long int OP2, 8798fa80f29Smrg mpc_rnd_t RND) 880062d2d48Smrg Set ROP to OP1 divided by 2 raised to OP2 rounded according to RND. 881062d2d48Smrg Just modifies the exponents of the real and imaginary parts by OP2 882062d2d48Smrg when ROP and OP1 are identical. 8838fa80f29Smrg 8848fa80f29Smrg 8858fa80f29SmrgFile: mpc.info, Node: Power Functions and Logarithm, Next: Trigonometric Functions, Prev: Basic Arithmetic, Up: Complex Functions 8868fa80f29Smrg 8878fa80f29Smrg5.8 Power Functions and Logarithm 8888fa80f29Smrg================================= 8898fa80f29Smrg 890a0d373eeSmrg -- Function: int mpc_sqrt (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 8918fa80f29Smrg Set ROP to the square root of OP rounded according to RND. The 8928fa80f29Smrg returned value ROP has a non-negative real part, and if its real 8938fa80f29Smrg part is zero, a non-negative imaginary part. 8948fa80f29Smrg 895a0d373eeSmrg -- Function: int mpc_pow (mpc_t ROP, const mpc_t OP1, const mpc_t OP2, 8968fa80f29Smrg mpc_rnd_t RND) 897a0d373eeSmrg -- Function: int mpc_pow_d (mpc_t ROP, const mpc_t OP1, double OP2, 8988fa80f29Smrg mpc_rnd_t RND) 899a0d373eeSmrg -- Function: int mpc_pow_ld (mpc_t ROP, const mpc_t OP1, long double 900a0d373eeSmrg OP2, mpc_rnd_t RND) 901a0d373eeSmrg -- Function: int mpc_pow_si (mpc_t ROP, const mpc_t OP1, long OP2, 9028fa80f29Smrg mpc_rnd_t RND) 903a0d373eeSmrg -- Function: int mpc_pow_ui (mpc_t ROP, const mpc_t OP1, unsigned long 904a0d373eeSmrg OP2, mpc_rnd_t RND) 905a0d373eeSmrg -- Function: int mpc_pow_z (mpc_t ROP, const mpc_t OP1, const mpz_t 906a0d373eeSmrg OP2, mpc_rnd_t RND) 907a0d373eeSmrg -- Function: int mpc_pow_fr (mpc_t ROP, const mpc_t OP1, const mpfr_t 908a0d373eeSmrg OP2, mpc_rnd_t RND) 9098fa80f29Smrg Set ROP to OP1 raised to the power OP2, rounded according to RND. 910*367b8279Smrg For ‘mpc_pow_d’, ‘mpc_pow_ld’, ‘mpc_pow_si’, ‘mpc_pow_ui’, 911*367b8279Smrg ‘mpc_pow_z’ and ‘mpc_pow_fr’, the imaginary part of OP2 is 9128fa80f29Smrg considered as +0. When both OP1 and OP2 are zero, the result has 9138fa80f29Smrg real part 1, and imaginary part 0, with sign being the opposite of 9148fa80f29Smrg that of OP2. 9158fa80f29Smrg 916a0d373eeSmrg -- Function: int mpc_exp (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 917062d2d48Smrg Set ROP to the exponential of OP, rounded according to RND with the 918062d2d48Smrg precision of ROP. 9198fa80f29Smrg 920a0d373eeSmrg -- Function: int mpc_log (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 921a0d373eeSmrg -- Function: int mpc_log10 (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 9228fa80f29Smrg Set ROP to the natural and base-10 logarithm of OP respectively, 9238fa80f29Smrg rounded according to RND with the precision of ROP. The principal 924062d2d48Smrg branch is chosen, with the branch cut on the negative real axis, so 92590a8ff21Smrg that the imaginary part of the result lies in ]-Pi , Pi] and 92690a8ff21Smrg ]-Pi/log(10) , Pi/log(10)] respectively. 9278fa80f29Smrg 92839f28e1eSmrg -- Function: int mpc_rootofunity (mpc_t ROP, unsigned long int N, 92939f28e1eSmrg unsigned long int K, mpc_rnd_t RND) 93039f28e1eSmrg Set ROP to the standard primitive N-th root of unity raised to the 93190a8ff21Smrg power K, that is, exp (2 Pi i k / n), rounded according to RND with 93290a8ff21Smrg the precision of ROP. 93339f28e1eSmrg 934*367b8279Smrg -- Function: int mpc_agm (mpc_t ROP, const mpc_t A, const mpc_t B, 935*367b8279Smrg mpc_rnd_t RND) 936*367b8279Smrg Set ROP to the arithmetic-geometric mean (AGM) of A and B, rounded 937*367b8279Smrg according to RND with the precision of ROP. Concerning the branch 938*367b8279Smrg cut, the function is computed by homogeneity either as A AGM(1,b0) 939*367b8279Smrg with b0=B/A if |A|>=|B|, or as B AGM(1,b0) with b0=A/B otherwise; 940*367b8279Smrg then when b0 is real and negative, AGM(1,b0) is chosen to have 941*367b8279Smrg positive imaginary part. 942*367b8279Smrg 9438fa80f29Smrg 944*367b8279SmrgFile: mpc.info, Node: Trigonometric Functions, Next: Modular Functions, Prev: Power Functions and Logarithm, Up: Complex Functions 9458fa80f29Smrg 9468fa80f29Smrg5.9 Trigonometric Functions 9478fa80f29Smrg=========================== 9488fa80f29Smrg 949a0d373eeSmrg -- Function: int mpc_sin (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 950a0d373eeSmrg -- Function: int mpc_cos (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 951a0d373eeSmrg -- Function: int mpc_tan (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 952a0d373eeSmrg Set ROP to the sine, cosine, tangent of OP, rounded according to 953a0d373eeSmrg RND with the precision of ROP. 9548fa80f29Smrg 955a0d373eeSmrg -- Function: int mpc_sin_cos (mpc_t ROP_SIN, mpc_t ROP_COS, const mpc_t 956a0d373eeSmrg OP, mpc_rnd_t RND_SIN, mpc_rnd_t RND_COS) 9578fa80f29Smrg Set ROP_SIN to the sine of OP, rounded according to RND_SIN with 9588fa80f29Smrg the precision of ROP_SIN, and ROP_COS to the cosine of OP, rounded 9598fa80f29Smrg according to RND_COS with the precision of ROP_COS. 9608fa80f29Smrg 961a0d373eeSmrg -- Function: int mpc_sinh (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 962a0d373eeSmrg -- Function: int mpc_cosh (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 963a0d373eeSmrg -- Function: int mpc_tanh (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 964a0d373eeSmrg Set ROP to the hyperbolic sine, hyperbolic cosine, hyperbolic 965a0d373eeSmrg tangent of OP, rounded according to RND with the precision of ROP. 9668fa80f29Smrg 967a0d373eeSmrg -- Function: int mpc_asin (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 968a0d373eeSmrg -- Function: int mpc_acos (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 969a0d373eeSmrg -- Function: int mpc_atan (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 9708fa80f29Smrg Set ROP to the inverse sine, inverse cosine, inverse tangent of OP, 9718fa80f29Smrg rounded according to RND with the precision of ROP. 9728fa80f29Smrg 973a0d373eeSmrg -- Function: int mpc_asinh (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 974a0d373eeSmrg -- Function: int mpc_acosh (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 975a0d373eeSmrg -- Function: int mpc_atanh (mpc_t ROP, const mpc_t OP, mpc_rnd_t RND) 9768fa80f29Smrg Set ROP to the inverse hyperbolic sine, inverse hyperbolic cosine, 977062d2d48Smrg inverse hyperbolic tangent of OP, rounded according to RND with the 978*367b8279Smrg precision of ROP. The branch cut of ‘mpc_acosh’ is (-Inf, 1) 9798fa80f29Smrg 9808fa80f29Smrg 981*367b8279SmrgFile: mpc.info, Node: Modular Functions, Next: Miscellaneous Complex Functions, Prev: Trigonometric Functions, Up: Complex Functions 9828fa80f29Smrg 983*367b8279Smrg5.10 Modular Functions 984*367b8279Smrg====================== 985*367b8279Smrg 986*367b8279SmrgThe following function is experimental, not least because it depends on 987*367b8279Smrgthe equally experimental ball arithmetic, see *note Ball Arithmetic::. 988*367b8279SmrgSo its prototype may change in future releases, and it may be removed 989*367b8279Smrgaltogether. 990*367b8279Smrg 991*367b8279Smrg -- Function: int mpc_eta_fund (mpc_t ROP, const mpc_t OP, mpc_rnd_t 992*367b8279Smrg RND) 993*367b8279Smrg Assuming that the argument OP lies in the fundamental domain for 994*367b8279Smrg Sl_2(Z), that is, it has real part not below -1/2 and not above 995*367b8279Smrg +1/2 and absolute value at least 1, return the value of the 996*367b8279Smrg Dedekind eta-function in ROP. For arguments outside the 997*367b8279Smrg fundamental domain the function is expected to loop indefinitely. 998*367b8279Smrg 999*367b8279Smrg 1000*367b8279SmrgFile: mpc.info, Node: Miscellaneous Complex Functions, Next: Advanced Functions, Prev: Modular Functions, Up: Complex Functions 1001*367b8279Smrg 1002*367b8279Smrg5.11 Miscellaneous Functions 10038fa80f29Smrg============================ 10048fa80f29Smrg 10058fa80f29Smrg -- Function: int mpc_urandom (mpc_t ROP, gmp_randstate_t STATE) 10068fa80f29Smrg Generate a uniformly distributed random complex in the unit square 10078fa80f29Smrg [0, 1] x [0, 1]. Return 0, unless an exponent in the real or 10088fa80f29Smrg imaginary part is not in the current exponent range, in which case 10098fa80f29Smrg that part is set to NaN and a zero value is returned. The second 1010*367b8279Smrg argument is a ‘gmp_randstate_t’ structure which should be created 1011*367b8279Smrg using the GMP ‘rand_init’ function, see the GMP manual. 10128fa80f29Smrg 10138fa80f29Smrg -- Function: const char * mpc_get_version (void) 10148fa80f29Smrg Return the GNU MPC version, as a null-terminated string. 10158fa80f29Smrg 10168fa80f29Smrg -- Macro: MPC_VERSION 10178fa80f29Smrg -- Macro: MPC_VERSION_MAJOR 10188fa80f29Smrg -- Macro: MPC_VERSION_MINOR 10198fa80f29Smrg -- Macro: MPC_VERSION_PATCHLEVEL 10208fa80f29Smrg -- Macro: MPC_VERSION_STRING 1021*367b8279Smrg ‘MPC_VERSION’ is the version of GNU MPC as a preprocessing 1022*367b8279Smrg constant. ‘MPC_VERSION_MAJOR’, ‘MPC_VERSION_MINOR’ and 1023*367b8279Smrg ‘MPC_VERSION_PATCHLEVEL’ are respectively the major, minor and 10248fa80f29Smrg patch level of GNU MPC version, as preprocessing constants. 1025*367b8279Smrg ‘MPC_VERSION_STRING’ is the version as a string constant, which can 1026*367b8279Smrg be compared to the result of ‘mpc_get_version’ to check at run time 1027062d2d48Smrg the header file and library used match: 10288fa80f29Smrg if (strcmp (mpc_get_version (), MPC_VERSION_STRING)) 10298fa80f29Smrg fprintf (stderr, "Warning: header and library do not match\n"); 10308fa80f29Smrg Note: Obtaining different strings is not necessarily an error, as 10318fa80f29Smrg in general, a program compiled with some old GNU MPC version can be 1032062d2d48Smrg dynamically linked with a newer GNU MPC library version (if allowed 1033062d2d48Smrg by the library versioning system). 10348fa80f29Smrg 10358fa80f29Smrg -- Macro: long MPC_VERSION_NUM (MAJOR, MINOR, PATCHLEVEL) 1036*367b8279Smrg Create an integer in the same format as used by ‘MPC_VERSION’ from 10378fa80f29Smrg the given MAJOR, MINOR and PATCHLEVEL. Here is an example of how 10388fa80f29Smrg to check the GNU MPC version at compile time: 10398fa80f29Smrg #if (!defined(MPC_VERSION) || (MPC_VERSION<MPC_VERSION_NUM(2,1,0))) 10408fa80f29Smrg # error "Wrong GNU MPC version." 10418fa80f29Smrg #endif 10428fa80f29Smrg 10438fa80f29Smrg 10448fa80f29SmrgFile: mpc.info, Node: Advanced Functions, Next: Internals, Prev: Miscellaneous Complex Functions, Up: Complex Functions 10458fa80f29Smrg 1046*367b8279Smrg5.12 Advanced Functions 10478fa80f29Smrg======================= 10488fa80f29Smrg 10498fa80f29Smrg -- Macro: MPC_SET_X_Y (REAL_SUFFIX, IMAG_SUFFIX, ROP, REAL, IMAG, RND) 10508fa80f29Smrg The macro MPC_SET_X_Y is designed to serve as the body of an 10518fa80f29Smrg assignment function and cannot be used by itself. The REAL_SUFFIX 10528fa80f29Smrg and IMAG_SUFFIX parameters are the types of the real and imaginary 1053*367b8279Smrg part, that is, the ‘x’ in the ‘mpfr_set_x’ function one would use 1054*367b8279Smrg to set the part; for the mpfr type, use ‘fr’. REAL (respectively 10558fa80f29Smrg IMAG) is the value you want to assign to the real (resp. 10568fa80f29Smrg imaginary) part, its type must conform to REAL_SUFFIX (resp. 1057*367b8279Smrg IMAG_SUFFIX). RND is the ‘mpc_rnd_t’ rounding mode. The return 10588fa80f29Smrg value is the usual inexact value (*note Return Value: 10598fa80f29Smrg return-value.). 10608fa80f29Smrg 10618fa80f29Smrg For instance, you can define mpc_set_ui_fr as follows: 1062a0d373eeSmrg int mpc_set_ui_fr (mpc_t rop, unsigned long int re, mpfr_t im, mpc_rnd_t rnd) 10638fa80f29Smrg MPC_SET_X_Y (ui, fr, rop, re, im, rnd); 10648fa80f29Smrg 10658fa80f29Smrg 10668fa80f29SmrgFile: mpc.info, Node: Internals, Prev: Advanced Functions, Up: Complex Functions 10678fa80f29Smrg 1068*367b8279Smrg5.13 Internals 10698fa80f29Smrg============== 10708fa80f29Smrg 1071062d2d48SmrgThese macros and functions are mainly designed for the implementation of 1072062d2d48SmrgGNU MPC, but may be useful for users too. However, no upward 1073*367b8279Smrgcompatibility is guaranteed. You need to include ‘mpc-impl.h’ to use 10748fa80f29Smrgthem. 10758fa80f29Smrg 1076*367b8279Smrg The macro ‘MPC_MAX_PREC(z)’ gives the maximum of the precisions of 10778fa80f29Smrgthe real and imaginary parts of a complex number. 10788fa80f29Smrg 10798fa80f29Smrg 1080*367b8279SmrgFile: mpc.info, Node: Ball Arithmetic, Next: References, Prev: Complex Functions, Up: Top 1081*367b8279Smrg 1082*367b8279Smrg6 Ball Arithmetic 1083*367b8279Smrg***************** 1084*367b8279Smrg 1085*367b8279SmrgSince release 1.3.0, GNU MPC contains a simple and very limited 1086*367b8279Smrgimplementation of complex balls (or rather, circles). This part is 1087*367b8279Smrgexperimental, its interface may vary and it may be removed completely in 1088*367b8279Smrgfuture releases. 1089*367b8279Smrg 1090*367b8279Smrg A complex ball of the new type ‘mpcb_t’ is defined by a non-zero 1091*367b8279Smrgcentre c of the type ‘mpc_t’ and a relative radius r of the new type 1092*367b8279Smrg‘mpcr_t’, and it represents all complex numbers z = c (1 + ϑ) with |ϑ| ≤ 1093*367b8279Smrgr, or equivalently the closed circle with centre c and radius r |c|. 1094*367b8279SmrgThe approach of using a relative error (or radius) instead of an 1095*367b8279Smrgabsolute one simplifies error analyses for multiplicative operations 1096*367b8279Smrg(multiplication, division, square roots, and the AGM), at the expense of 1097*367b8279Smrgmaking them more complicated for additive operations. It has the major 1098*367b8279Smrgdrawback of not being able to represent balls centred at 0; in floating 1099*367b8279Smrgpoint arithmetic, however, 0 is never reached by rounding, but only 1100*367b8279Smrgthrough operations with exact result, which could be handled at a 1101*367b8279Smrghigher, application level. For more discussion on these issues, see the 1102*367b8279Smrgfile ‘algorithms.tex’. 1103*367b8279Smrg 1104*367b8279Smrg6.1 Radius type and functions 1105*367b8279Smrg============================= 1106*367b8279Smrg 1107*367b8279SmrgThe radius type is defined by 1108*367b8279Smrgstruct { 1109*367b8279Smrg int64_t mant; 1110*367b8279Smrg int64_t exp; 1111*367b8279Smrg} 1112*367b8279Smrg with the usual trick in the GNU multiprecision libraries of defining 1113*367b8279Smrgthe main type ‘mpcr_t’ as a 1-dimensional array of this struct, and 1114*367b8279Smrgvariable and constant pointers ‘mpcr_ptr’ and ‘mpcr_srcptr’. It can 1115*367b8279Smrgcontain the special values infinity or zero, or floating point numbers 1116*367b8279Smrgencoded as m⋅2^{e} for a positive mantissa m and an arbitrary (usually 1117*367b8279Smrgnegative) exponent e. Normalised finite radii use 31 bits for the 1118*367b8279Smrgmantissa, that is, 2^{30}≤m≤2^{31} - 1. The special values infinity and 1119*367b8279Smrg0 are encoded through the sign of m, but should be tested for and set 1120*367b8279Smrgusing dedicated functions. 1121*367b8279Smrg 1122*367b8279Smrg Unless indicated otherwise, the following functions assume radius 1123*367b8279Smrgarguments to be normalised, they return normalised results, and they 1124*367b8279Smrground their results up, not necessarily to the smallest representable 1125*367b8279Smrgnumber, although reasonable effort is made to get a tight upper bound: 1126*367b8279SmrgThey only guarantee that their outputs are an upper bound on the true 1127*367b8279Smrgresults. (There may be a trade-off between tightness of the result and 1128*367b8279Smrgspeed of computation. For instance, when a 32-bit mantissa is 1129*367b8279Smrgnormalised, an even mantissa should be divided by 2, an odd mantissa 1130*367b8279Smrgshould be divided by 2 and 1 should be added, and then in both cases the 1131*367b8279Smrgexponent must be increased by 1. It might be more efficient to add 1 1132*367b8279Smrgall the time instead of testing the last bit of the mantissa.) 1133*367b8279Smrg 1134*367b8279Smrg -- Function: int mpcr_inf_p (mpcr_srcptr R) 1135*367b8279Smrg -- Function: int mpcr_zero_p (mpcr_srcptr R) 1136*367b8279Smrg Test whether R is infinity or zero, respectively, and return a 1137*367b8279Smrg boolean. 1138*367b8279Smrg 1139*367b8279Smrg -- Function: int mpcr_lt_half_p (mpcr_srcptr R) 1140*367b8279Smrg Return ‘true’ if R<1/2, and ‘false’ otherwise. (Everywhere in this 1141*367b8279Smrg document, ‘true’ means any non-zero value, and ‘false’ means zero.) 1142*367b8279Smrg 1143*367b8279Smrg -- Function: int mpcr_cmp (mpcr_srcptr R, mpcr_srcptr S) 1144*367b8279Smrg Return +1, 0 or -1 depending on whether R is larger than, equal to 1145*367b8279Smrg or less than S, with the natural total order on the compactified 1146*367b8279Smrg non-negative real axis letting 0 be smaller and letting infinity be 1147*367b8279Smrg larger than any finite real number. 1148*367b8279Smrg 1149*367b8279Smrg -- Function: void mpcr_set_inf (mpcr_ptr R) 1150*367b8279Smrg -- Function: void mpcr_set_zero (mpcr_ptr R) 1151*367b8279Smrg -- Function: void mpcr_set_one (mpcr_ptr R) 1152*367b8279Smrg -- Function: void mpcr_set (mpcr_ptr R, mpcr_srcptr S) 1153*367b8279Smrg -- Function: void mpcr_set_ui64_2si64 (mpcr_ptr R, uint64_t MANT, 1154*367b8279Smrg int64_t EXP) 1155*367b8279Smrg Set R to infinity, zero, 1, S or MANT⋅2^{EXP}, respectively. 1156*367b8279Smrg 1157*367b8279Smrg -- Function: void mpcr_max (mpcr_ptr R, mpcr_srcptr S, mpcr_srcptr T) 1158*367b8279Smrg Set R to the maximum of S and T. 1159*367b8279Smrg 1160*367b8279Smrg -- Function: int64_t mpcr_get_exp (mpcr_srcptr R) 1161*367b8279Smrg Assuming that R is neither infinity nor 0, return its exponent e 1162*367b8279Smrg when writing r = m⋅2^{e} with 1/2 ≤ m < 1. (Notice that this is 1163*367b8279Smrg _not_ the same as the field ‘exp’ in the struct representing a 1164*367b8279Smrg radius, but that instead it is independent of the implementation.) 1165*367b8279Smrg Otherwise the behaviour is undefined. 1166*367b8279Smrg 1167*367b8279Smrg -- Function: void mpcr_out_str (FILE *F, mpcr_srcptr R) 1168*367b8279Smrg Output R on F, which may be ‘stdout’. Caveat: This function so far 1169*367b8279Smrg serves mainly for debugging purposes, its behaviour will probably 1170*367b8279Smrg change in the future. 1171*367b8279Smrg 1172*367b8279Smrg -- Function: void mpcr_add (mpcr_ptr R, mpcr_srcptr S, mpcr_srcptr T) 1173*367b8279Smrg -- Function: void mpcr_sub (mpcr_ptr R, mpcr_srcptr S, mpcr_srcptr T) 1174*367b8279Smrg -- Function: void mpcr_mul (mpcr_ptr R, mpcr_srcptr S, mpcr_srcptr T) 1175*367b8279Smrg -- Function: void mpcr_div (mpcr_ptr R, mpcr_srcptr S, mpcr_srcptr T) 1176*367b8279Smrg -- Function: void mpcr_mul_2ui (mpcr_ptr R, mpcr_srcptr S, unsigned 1177*367b8279Smrg long int T) 1178*367b8279Smrg -- Function: void mpcr_div_2ui (mpcr_ptr R, mpcr_srcptr S, unsigned 1179*367b8279Smrg long int T) 1180*367b8279Smrg -- Function: void mpcr_sqr (mpcr_ptr R, mpcr_srcptr S) 1181*367b8279Smrg -- Function: void mpcr_sqrt (mpcr_ptr R, mpcr_srcptr S) 1182*367b8279Smrg Set R to the sum, difference, product or quotient of S and T, or to 1183*367b8279Smrg the product of S by 2^{T} or to the quotient of S by 2^{T}, or to 1184*367b8279Smrg the square or the square root of S. If any of the arguments is 1185*367b8279Smrg infinity, or if a difference is negative, the result is infinity. 1186*367b8279Smrg 1187*367b8279Smrg -- Function: void mpcr_sub_rnd (mpcr_ptr R, mpcr_srcptr S, mpcr_srcptr 1188*367b8279Smrg T, mpfr_rnd_t RND) 1189*367b8279Smrg Set R to the difference of S and T, rounded into direction RND, 1190*367b8279Smrg which can be one of ‘MPFR_RNDU’ or ‘MPFR_RNDD’. If one of the 1191*367b8279Smrg arguments is infinity or the difference is negative, the result is 1192*367b8279Smrg infinity. Calling the function with ‘MPFR_RNDU’ is equivalent to 1193*367b8279Smrg calling ‘mpcr_sub’. 1194*367b8279Smrg 1195*367b8279Smrg This is one out of several functions taking a rounding parameter. 1196*367b8279Smrg Rounding down may be useful to obtain an upper bound when dividing 1197*367b8279Smrg by the result. 1198*367b8279Smrg 1199*367b8279Smrg -- Function: void mpcr_c_abs_rnd (mpcr_ptr R, mpc_srcptr Z, mpfr_rnd_t 1200*367b8279Smrg RND) 1201*367b8279Smrg Set R to the absolute value of the complex number Z, rounded in 1202*367b8279Smrg direction RND, which may be one of ‘MPFR_RNDU’ or ‘MPFR_RNDD’. 1203*367b8279Smrg 1204*367b8279Smrg -- Function: void mpcr_add_rounding_error (mpcr_ptr R, mpfr_prec_t P, 1205*367b8279Smrg mpfr_rnd_t RND) 1206*367b8279Smrg Set R to r + (1 + r) 2^{-p} if RND equals ‘MPFR_RNDN’, and to r + 1207*367b8279Smrg (1 + r) 2^{1-p} otherwise. The idea is that if a (potentially not 1208*367b8279Smrg representable) centre of an ideal complex ball of radius R is 1209*367b8279Smrg rounded to a representable complex number at precision P, this 1210*367b8279Smrg shifts the centre by up to 1/2 ulp (for rounding to nearest) or 1 1211*367b8279Smrg ulp (for directed rounding of at least one of the real or imaginary 1212*367b8279Smrg parts), which increases the radius accordingly. So this function 1213*367b8279Smrg is typically called internally at the end of each operation with 1214*367b8279Smrg complex balls to account for the error made by rounding the centre. 1215*367b8279Smrg 1216*367b8279Smrg6.2 Ball type and functions 1217*367b8279Smrg=========================== 1218*367b8279Smrg 1219*367b8279SmrgThe ball type is defined by 1220*367b8279Smrgtypedef struct { 1221*367b8279Smrg mpc_t c; 1222*367b8279Smrg mpcr_t r; 1223*367b8279Smrg} 1224*367b8279Smrg or, more precisely, ‘mpcb_t’ is again a 1-dimensional array of such a 1225*367b8279Smrgstruct, and variable and constant pointer types are defined as 1226*367b8279Smrg‘mpcb_ptr’ and ‘mpcb_srcptr’, respectively. As usual, the components 1227*367b8279Smrgshould only be accessed through corresponding functions. 1228*367b8279Smrg 1229*367b8279Smrg To understand functions on balls, one needs to consider the balls 1230*367b8279Smrgpassed as arguments as sets of complex values, to which a mathematical 1231*367b8279Smrgfunction is applied; the C function “rounds up” in the sense that it 1232*367b8279Smrgreturns a ball containing all possible values of the function in all the 1233*367b8279Smrgpossible input values. Reasonable effort is made to return small balls, 1234*367b8279Smrgbut again there is no guarantee that the result is the smallest possible 1235*367b8279Smrgone. In the current implementation, the centre of a ball returned as a 1236*367b8279Smrgvalue is obtained by applying the function to the centres of the balls 1237*367b8279Smrgpassed as arguments, and rounding. While this is a natural approach, it 1238*367b8279Smrgis not the only possible one; however, it also simplifies the error 1239*367b8279Smrganalysis as already carried out for functions with regular complex 1240*367b8279Smrgarguments. Whenever the centre of a complex ball has a non-finite real 1241*367b8279Smrgor imaginary part (positive or negative infinity or NaN) the radius is 1242*367b8279Smrgset to infinity; this can be interpreted as the “useless ball”, 1243*367b8279Smrgrepresenting the whole complex plane, whatever the value of the centre 1244*367b8279Smrgis. 1245*367b8279Smrg 1246*367b8279Smrg Unlike for variables of ‘mpc_t’ type, where the precision needs to be 1247*367b8279Smrgset explicitly at initialisation, variables of type ‘mpcb_t’ handle 1248*367b8279Smrgtheir precision dynamically. Ball centres always have the same 1249*367b8279Smrgprecision for their real and their imaginary parts (again this is a 1250*367b8279Smrgchoice of the implementation; if they are of very different sizes, one 1251*367b8279Smrgcould theoretically reduce the precision of the part that is smaller in 1252*367b8279Smrgabsolute value, which is more strongly affected by the common error 1253*367b8279Smrgcoded in the radius). When setting a complex ball from a value of a 1254*367b8279Smrgdifferent type, an additional precision parameter is passed, which 1255*367b8279Smrgdetermines the precision of the centre. Functions on complex balls set 1256*367b8279Smrgthe precision of their result depending on the input. In the current 1257*367b8279Smrgimplementation, this is the minimum of the argument precisions, so if 1258*367b8279Smrgall balls are initially set to the same precision, this is preserved 1259*367b8279Smrgthroughout the computations. (Notice that the exponent of the radius 1260*367b8279Smrgencodes roughly the number of correct binary digits of the ball centre; 1261*367b8279Smrgso it would also make sense to reduce the precision if the radius 1262*367b8279Smrgbecomes larger.) 1263*367b8279Smrg 1264*367b8279Smrg The following functions on complex balls are currently available; the 1265*367b8279Smrgeclectic collection is motivated by the desire to provide an 1266*367b8279Smrgimplementation of the arithmetic-geometric mean of complex numbers 1267*367b8279Smrgthrough the use of ball arithmetic. As for functions taking complex 1268*367b8279Smrgarguments, there may be arbitrary overlaps between variables 1269*367b8279Smrgrepresenting arguments and results; for instance ‘mpcb_mul (z, z, z)’ is 1270*367b8279Smrgan allowed way of replacing the ball Z by its square. 1271*367b8279Smrg 1272*367b8279Smrg -- Function: void mpcb_init (mpcb_ptr Z) 1273*367b8279Smrg -- Function: void mpcb_clear (mpcb_ptr Z) 1274*367b8279Smrg Initialise or free memory for Z; ‘mpcb_init’ must be called once 1275*367b8279Smrg before using a variable, and ‘mpcb_clear’ must be called once 1276*367b8279Smrg before stopping to use a variable. Unlike its ‘mpc_t’ counterpart, 1277*367b8279Smrg ‘mpcb_init’ does not fix the precision of Z, but it sets its radius 1278*367b8279Smrg to infinity, so that Z represents the whole complex plane. 1279*367b8279Smrg 1280*367b8279Smrg -- Function: mpfr_prec_t mpcb_get_prec (mpcb_srcptr Z) 1281*367b8279Smrg Return the (common) precision of the real and the complex parts of 1282*367b8279Smrg the centre of Z. 1283*367b8279Smrg 1284*367b8279Smrg -- Function: void mpcb_set (mpcb_ptr Z, mpcb_srcptr Z1) 1285*367b8279Smrg Set Z to Z1, preserving the precision of the centre. 1286*367b8279Smrg 1287*367b8279Smrg -- Function: void mpcb_set_inf (mpcb_ptr Z) 1288*367b8279Smrg Set Z to the whole complex plane. This is intended to be used much 1289*367b8279Smrg in the spirit of an assertion: When a precondition is not satisfied 1290*367b8279Smrg inside a function, it can set its result to this value, which will 1291*367b8279Smrg propagate through further computations. 1292*367b8279Smrg 1293*367b8279Smrg -- Function: void mpcb_set_c (mpcb_ptr Z, mpc_srcptr C, mpfr_prec_t 1294*367b8279Smrg PREC, unsigned long int ERR_RE, unsigned long int ERR_IM) 1295*367b8279Smrg Set Z to a ball with centre C at precision PREC. If PREC is at 1296*367b8279Smrg least the maximum of the precisions of the real and the imaginary 1297*367b8279Smrg parts of C and ERR_RE and ERR_IM are 0, then the resulting ball is 1298*367b8279Smrg exact with radius zero. Using a larger value for PREC makes sense 1299*367b8279Smrg if C is considered exact and a larger target precision for the 1300*367b8279Smrg result is desired, or some leeway for the working precision is to 1301*367b8279Smrg be taken into account. If PREC is less than the precision of C, 1302*367b8279Smrg then usually some rounding error occurs when setting the centre, 1303*367b8279Smrg which is taken into account in the radius. 1304*367b8279Smrg 1305*367b8279Smrg If ERR_RE and ERR_IM are non-zero, the argument C is considered as 1306*367b8279Smrg an inexact complex number, with a bound on the absolute error of 1307*367b8279Smrg its real part given in ERR_RE as a multiple of 1/2 ulp of the real 1308*367b8279Smrg part of C, and a bound on the absolute error of its imaginary part 1309*367b8279Smrg given in ERR_IM as a multiple of 1/2 ulp of the imaginary part of 1310*367b8279Smrg C. (Notice that if the parts of C have different precisions or 1311*367b8279Smrg exponents, the absolute values of their ulp differ.) Then Z is 1312*367b8279Smrg created as a ball with centre C and a radius taking these errors on 1313*367b8279Smrg C as well as the potential additional rounding error for the centre 1314*367b8279Smrg into account. If the real part of C is 0, then ERR_RE must be 0, 1315*367b8279Smrg since ulp of 0 makes no sense; otherwise the radius is set to 1316*367b8279Smrg infinity. The same remark holds for the imaginary part. 1317*367b8279Smrg 1318*367b8279Smrg Using ERR_RE and ERR_IM different from 0 is particularly useful in 1319*367b8279Smrg two settings: If C is itself the result of a call to an ‘mpc_’ 1320*367b8279Smrg function with exact input and rounding mode ‘MPC_RNDNN’ of both 1321*367b8279Smrg parts to nearest, then its parts are known with errors of at most 1322*367b8279Smrg 1/2 ulp, and setting ERR_RE and ERR_IM to 1 yields a ball which is 1323*367b8279Smrg known to contain the exact result (this motivates the strange unit 1324*367b8279Smrg of 1/2 ulp); if directed rounding was used, ERR_RE and ERR_IM can 1325*367b8279Smrg be set to 2 instead. 1326*367b8279Smrg 1327*367b8279Smrg And if C is the result of a sequence of calls to ‘mpc_’ functions 1328*367b8279Smrg for which some error analysis has been carried out (as is 1329*367b8279Smrg frequently the case internally when implementing complex 1330*367b8279Smrg functions), again the resulting ball Z is known to contain the 1331*367b8279Smrg exact result when using appropriate values for ERR_RE and ERR_IM. 1332*367b8279Smrg 1333*367b8279Smrg -- Function: void mpcb_set_ui_ui (mpcb_ptr Z, unsigned long int RE, 1334*367b8279Smrg unsigned long int IM, mpfr_prec_t PREC) 1335*367b8279Smrg Set Z to a ball with centre RE+I*IM at precision PREC or the size 1336*367b8279Smrg of an ‘unsigned long int’, whatever is larger. 1337*367b8279Smrg 1338*367b8279Smrg -- Function: void mpcb_neg (mpcb_ptr Z, mpcb_srcptr Z1) 1339*367b8279Smrg -- Function: void mpcb_add (mpcb_ptr Z, mpcb_srcptr Z1, mpcb_srcptr Z2) 1340*367b8279Smrg -- Function: void mpcb_mul (mpcb_ptr Z, mpcb_srcptr Z1, mpcb_srcptr Z2) 1341*367b8279Smrg -- Function: void mpcb_sqr (mpcb_ptr Z, mpcb_srcptr Z1) 1342*367b8279Smrg -- Function: void mpcb_pow_ui (mpcb_ptr Z, mpcb_srcptr Z1, unsigned 1343*367b8279Smrg long int E) 1344*367b8279Smrg -- Function: void mpcb_sqrt (mpcb_ptr Z, mpcb_srcptr Z1) 1345*367b8279Smrg -- Function: void mpcb_div (mpcb_ptr Z, mpcb_srcptr Z1, mpcb_srcptr Z2) 1346*367b8279Smrg -- Function: void mpcb_div_2ui (mpcb_ptr Z, mpcb_srcptr Z1, unsigned 1347*367b8279Smrg long int E) 1348*367b8279Smrg These are the exact counterparts of the corresponding functions 1349*367b8279Smrg ‘mpc_neg’, ‘mpc_add’ and so on, but on complex balls instead of 1350*367b8279Smrg complex numbers. 1351*367b8279Smrg 1352*367b8279Smrg -- Function: int mpcb_can_round (mpcb_srcptr Z, mpfr_prec_t PREC_RE, 1353*367b8279Smrg mpfr_prec_t PREC_IM, mpc_rnd_t RND) 1354*367b8279Smrg If the function returns ‘true’ (a non-zero number), then rounding 1355*367b8279Smrg any of the complex numbers in the ball to a complex number with 1356*367b8279Smrg precision PREC_RE of its real and precision PREC_IM of its 1357*367b8279Smrg imaginary part and rounding mode RND yields the same result and 1358*367b8279Smrg rounding direction value, cf. *note return-value::. If the 1359*367b8279Smrg function returns ‘false’ (that is, 0), then it could not conclude, 1360*367b8279Smrg or there are two numbers in the ball which would be rounded to a 1361*367b8279Smrg different complex number or in a different direction. Notice that 1362*367b8279Smrg the function works in a best effort mode and errs on the side of 1363*367b8279Smrg caution by potentially returning ‘false’ on a roundable ball; this 1364*367b8279Smrg is consistent with computational functions not necessarily 1365*367b8279Smrg returning the smallest enclosing ball. 1366*367b8279Smrg 1367*367b8279Smrg If Z contains the result of evaluating some mathematical function 1368*367b8279Smrg through a sequence of calls to ‘mpcb’ functions, starting with 1369*367b8279Smrg exact complex numbers, that is, balls of radius 0, then a return 1370*367b8279Smrg value of ‘true’ indicates that rounding any value in the ball (its 1371*367b8279Smrg centre is readily available) in direction RND yields the correct 1372*367b8279Smrg result of the function and the correct rounding direction value 1373*367b8279Smrg with the usual MPC semantics. 1374*367b8279Smrg 1375*367b8279Smrg Notice that when the precision of Z is larger than PREC_RE or 1376*367b8279Smrg PREC_IM, the centre need not be representable at the desired 1377*367b8279Smrg precision, and in fact the ball need not contain a representable 1378*367b8279Smrg number at all to be “roundable”. Even worse, when RND is a 1379*367b8279Smrg directed rounding mode for the real or the imaginary part and the 1380*367b8279Smrg ball of non-zero radius contains a representable number, the return 1381*367b8279Smrg value is necessarily ‘false’. Even worse, when the rounding mode 1382*367b8279Smrg for one part is to nearest, the corresponding part of the centre of 1383*367b8279Smrg the ball is representable and the ball has a non-zero radius, then 1384*367b8279Smrg the return value is also necessarily ‘false’, since even if 1385*367b8279Smrg rounding may be possible, the rounding direction value cannot be 1386*367b8279Smrg determined. 1387*367b8279Smrg 1388*367b8279Smrg -- Function: int mpcb_round (mpc_ptr C, mpcb_srcptr Z, mpc_rnd_t RND) 1389*367b8279Smrg Set C to the centre of Z, rounded in direction RND, and return the 1390*367b8279Smrg corresponding rounding direction value. If ‘mpcb_can_round’, 1391*367b8279Smrg called with Z, the precisions of C and the rounding mode RND 1392*367b8279Smrg returns ‘true’, then this function does what is expected, it 1393*367b8279Smrg “correctly rounds the ball” and returns a rounding direction value 1394*367b8279Smrg that is valid for all of the ball. As explained above, the result 1395*367b8279Smrg is then not necessarily (in the presence of directed rounding with 1396*367b8279Smrg radius different from 0, it is rather necessarily not) an element 1397*367b8279Smrg of the ball. 1398*367b8279Smrg 1399*367b8279Smrg 1400*367b8279SmrgFile: mpc.info, Node: References, Next: Concept Index, Prev: Ball Arithmetic, Up: Top 14018fa80f29Smrg 14028fa80f29SmrgReferences 14038fa80f29Smrg********** 14048fa80f29Smrg 1405*367b8279Smrg • Torbjörn Granlund et al. ‘GMP’ – GNU multiprecision library. 1406a0d373eeSmrg Version 6.2.0, <http://gmplib.org>. 14078fa80f29Smrg 1408*367b8279Smrg • Guillaume Hanrot, Vincent Lefèvre, Patrick Pélissier, Paul 1409*367b8279Smrg Zimmermann et al. ‘MPFR’ – A library for multiple-precision 1410a0d373eeSmrg floating-point computations with exact rounding. Version 4.1.0, 1411062d2d48Smrg <http://www.mpfr.org>. 14128fa80f29Smrg 1413*367b8279Smrg • IEEE Standard for Floating-Point Arithmetic, IEEE Computer Society, 1414a0d373eeSmrg IEEE Std 754-2019, Approved 13 June 2019, 84 pages. 14158fa80f29Smrg 1416*367b8279Smrg • Donald E. Knuth, "The Art of Computer Programming", vol 2, 14178fa80f29Smrg "Seminumerical Algorithms", 2nd edition, Addison-Wesley, 1981. 14188fa80f29Smrg 1419*367b8279Smrg • ISO/IEC 9899:1999, Programming languages — C. 14208fa80f29Smrg 14218fa80f29Smrg 14228fa80f29SmrgFile: mpc.info, Node: Concept Index, Next: Function Index, Prev: References, Up: Top 14238fa80f29Smrg 14248fa80f29SmrgConcept Index 14258fa80f29Smrg************* 14268fa80f29Smrg 14278fa80f29Smrg[index] 14288fa80f29Smrg* Menu: 14298fa80f29Smrg 14308fa80f29Smrg* Arithmetic functions: Basic Arithmetic. (line 6) 1431*367b8279Smrg* Ball arithmetic: Ball Arithmetic. (line 6) 14328fa80f29Smrg* Comparison functions: Complex Comparison. (line 6) 14338fa80f29Smrg* Complex arithmetic functions: Basic Arithmetic. (line 6) 14348fa80f29Smrg* Complex assignment functions: Assigning Complex Numbers. 14358fa80f29Smrg (line 6) 14368fa80f29Smrg* Complex comparisons functions: Complex Comparison. (line 6) 14378fa80f29Smrg* Complex functions: Complex Functions. (line 6) 14388fa80f29Smrg* Complex number: GNU MPC Basics. (line 15) 14398fa80f29Smrg* Conditions for copying GNU MPC: Copying. (line 6) 14408fa80f29Smrg* Conversion functions: Converting Complex Numbers. 14418fa80f29Smrg (line 6) 14428fa80f29Smrg* Copying conditions: Copying. (line 6) 14438fa80f29Smrg* Installation: Installing GNU MPC. (line 6) 14448fa80f29Smrg* Logarithm: Power Functions and Logarithm. 14458fa80f29Smrg (line 6) 14468fa80f29Smrg* Miscellaneous complex functions: Miscellaneous Complex Functions. 14478fa80f29Smrg (line 6) 1448*367b8279Smrg* Modular functions: Modular Functions. (line 6) 144939f28e1eSmrg* mpc.h: GNU MPC Basics. (line 6) 14508fa80f29Smrg* Power functions: Power Functions and Logarithm. 14518fa80f29Smrg (line 6) 14528fa80f29Smrg* Precision: GNU MPC Basics. (line 19) 14538fa80f29Smrg* Projection and Decomposing Functions: Projection & Decomposing. 14548fa80f29Smrg (line 6) 14558fa80f29Smrg* Reporting bugs: Reporting Bugs. (line 6) 14568fa80f29Smrg* Rounding Mode: GNU MPC Basics. (line 24) 14578fa80f29Smrg* String and stream input and output: String and Stream Input and Output. 14588fa80f29Smrg (line 6) 14598fa80f29Smrg* Trigonometric functions: Trigonometric Functions. 14608fa80f29Smrg (line 6) 14618fa80f29Smrg* User-defined precision: Complex Functions. (line 12) 14628fa80f29Smrg 14638fa80f29Smrg 1464*367b8279SmrgFile: mpc.info, Node: Function Index, Next: Type Index, Prev: Concept Index, Up: Top 14658fa80f29Smrg 14668fa80f29SmrgFunction Index 14678fa80f29Smrg************** 14688fa80f29Smrg 14698fa80f29Smrg[index] 14708fa80f29Smrg* Menu: 14718fa80f29Smrg 14728fa80f29Smrg* _Complex: Converting Complex Numbers. 1473062d2d48Smrg (line 9) 1474*367b8279Smrg* mpcb_add: Ball Arithmetic. (line 260) 1475*367b8279Smrg* mpcb_can_round: Ball Arithmetic. (line 273) 1476*367b8279Smrg* mpcb_clear: Ball Arithmetic. (line 194) 1477*367b8279Smrg* mpcb_div: Ball Arithmetic. (line 266) 1478*367b8279Smrg* mpcb_div_2ui: Ball Arithmetic. (line 267) 1479*367b8279Smrg* mpcb_get_prec: Ball Arithmetic. (line 201) 1480*367b8279Smrg* mpcb_init: Ball Arithmetic. (line 193) 1481*367b8279Smrg* mpcb_mul: Ball Arithmetic. (line 261) 1482*367b8279Smrg* mpcb_neg: Ball Arithmetic. (line 259) 1483*367b8279Smrg* mpcb_pow_ui: Ball Arithmetic. (line 263) 1484*367b8279Smrg* mpcb_round: Ball Arithmetic. (line 309) 1485*367b8279Smrg* mpcb_set: Ball Arithmetic. (line 205) 1486*367b8279Smrg* mpcb_set_c: Ball Arithmetic. (line 214) 1487*367b8279Smrg* mpcb_set_inf: Ball Arithmetic. (line 208) 1488*367b8279Smrg* mpcb_set_ui_ui: Ball Arithmetic. (line 254) 1489*367b8279Smrg* mpcb_sqr: Ball Arithmetic. (line 262) 1490*367b8279Smrg* mpcb_sqrt: Ball Arithmetic. (line 265) 1491*367b8279Smrg* mpcr_add: Ball Arithmetic. (line 93) 1492*367b8279Smrg* mpcr_add_rounding_error: Ball Arithmetic. (line 125) 1493*367b8279Smrg* mpcr_cmp: Ball Arithmetic. (line 64) 1494*367b8279Smrg* mpcr_c_abs_rnd: Ball Arithmetic. (line 120) 1495*367b8279Smrg* mpcr_div: Ball Arithmetic. (line 96) 1496*367b8279Smrg* mpcr_div_2ui: Ball Arithmetic. (line 99) 1497*367b8279Smrg* mpcr_get_exp: Ball Arithmetic. (line 81) 1498*367b8279Smrg* mpcr_inf_p: Ball Arithmetic. (line 55) 1499*367b8279Smrg* mpcr_lt_half_p: Ball Arithmetic. (line 60) 1500*367b8279Smrg* mpcr_max: Ball Arithmetic. (line 78) 1501*367b8279Smrg* mpcr_mul: Ball Arithmetic. (line 95) 1502*367b8279Smrg* mpcr_mul_2ui: Ball Arithmetic. (line 97) 1503*367b8279Smrg* mpcr_out_str: Ball Arithmetic. (line 88) 1504*367b8279Smrg* mpcr_set: Ball Arithmetic. (line 73) 1505*367b8279Smrg* mpcr_set_inf: Ball Arithmetic. (line 70) 1506*367b8279Smrg* mpcr_set_one: Ball Arithmetic. (line 72) 1507*367b8279Smrg* mpcr_set_ui64_2si64: Ball Arithmetic. (line 74) 1508*367b8279Smrg* mpcr_set_zero: Ball Arithmetic. (line 71) 1509*367b8279Smrg* mpcr_sqr: Ball Arithmetic. (line 101) 1510*367b8279Smrg* mpcr_sqrt: Ball Arithmetic. (line 102) 1511*367b8279Smrg* mpcr_sub: Ball Arithmetic. (line 94) 1512*367b8279Smrg* mpcr_sub_rnd: Ball Arithmetic. (line 108) 1513*367b8279Smrg* mpcr_zero_p: Ball Arithmetic. (line 56) 1514*367b8279Smrg* mpc_abs: Basic Arithmetic. (line 99) 15158fa80f29Smrg* mpc_acos: Trigonometric Functions. 1516a0d373eeSmrg (line 25) 15178fa80f29Smrg* mpc_acosh: Trigonometric Functions. 1518a0d373eeSmrg (line 31) 1519*367b8279Smrg* mpc_add: Basic Arithmetic. (line 19) 1520*367b8279Smrg* mpc_add_fr: Basic Arithmetic. (line 23) 1521*367b8279Smrg* mpc_add_ui: Basic Arithmetic. (line 21) 1522*367b8279Smrg* mpc_agm: Power Functions and Logarithm. 1523*367b8279Smrg (line 50) 1524062d2d48Smrg* mpc_arg: Projection & Decomposing. 15258fa80f29Smrg (line 20) 1526062d2d48Smrg* mpc_asin: Trigonometric Functions. 1527a0d373eeSmrg (line 24) 1528062d2d48Smrg* mpc_asinh: Trigonometric Functions. 1529a0d373eeSmrg (line 30) 1530062d2d48Smrg* mpc_atan: Trigonometric Functions. 1531a0d373eeSmrg (line 26) 1532062d2d48Smrg* mpc_atanh: Trigonometric Functions. 1533a0d373eeSmrg (line 32) 1534062d2d48Smrg* mpc_clear: Initializing Complex Numbers. 15358fa80f29Smrg (line 21) 1536062d2d48Smrg* mpc_cmp: Complex Comparison. (line 6) 153739f28e1eSmrg* mpc_cmp_abs: Complex Comparison. (line 23) 1538062d2d48Smrg* mpc_cmp_si: Complex Comparison. (line 9) 1539062d2d48Smrg* mpc_cmp_si_si: Complex Comparison. (line 7) 1540*367b8279Smrg* mpc_conj: Basic Arithmetic. (line 94) 1541062d2d48Smrg* mpc_cos: Trigonometric Functions. 1542a0d373eeSmrg (line 7) 1543062d2d48Smrg* mpc_cosh: Trigonometric Functions. 1544a0d373eeSmrg (line 19) 1545*367b8279Smrg* mpc_div: Basic Arithmetic. (line 82) 1546*367b8279Smrg* mpc_div_2si: Basic Arithmetic. (line 117) 1547*367b8279Smrg* mpc_div_2ui: Basic Arithmetic. (line 115) 1548*367b8279Smrg* mpc_div_fr: Basic Arithmetic. (line 86) 1549*367b8279Smrg* mpc_div_ui: Basic Arithmetic. (line 84) 1550*367b8279Smrg* mpc_dot: Basic Arithmetic. (line 77) 1551*367b8279Smrg* mpc_eta_fund: Modular Functions. (line 11) 1552062d2d48Smrg* mpc_exp: Power Functions and Logarithm. 1553062d2d48Smrg (line 32) 1554*367b8279Smrg* mpc_fma: Basic Arithmetic. (line 72) 1555062d2d48Smrg* mpc_free_str: String and Stream Input and Output. 1556062d2d48Smrg (line 66) 1557*367b8279Smrg* mpc_fr_div: Basic Arithmetic. (line 90) 1558*367b8279Smrg* mpc_fr_sub: Basic Arithmetic. (line 31) 1559062d2d48Smrg* mpc_get_ldc: Converting Complex Numbers. 1560062d2d48Smrg (line 10) 1561062d2d48Smrg* mpc_get_prec: Initializing Complex Numbers. 1562062d2d48Smrg (line 49) 1563062d2d48Smrg* mpc_get_prec2: Initializing Complex Numbers. 1564062d2d48Smrg (line 53) 1565062d2d48Smrg* mpc_get_str: String and Stream Input and Output. 1566062d2d48Smrg (line 48) 1567062d2d48Smrg* mpc_get_version: Miscellaneous Complex Functions. 1568062d2d48Smrg (line 14) 1569062d2d48Smrg* mpc_imag: Projection & Decomposing. 1570062d2d48Smrg (line 10) 1571062d2d48Smrg* mpc_imagref: Projection & Decomposing. 1572062d2d48Smrg (line 15) 1573062d2d48Smrg* mpc_init2: Initializing Complex Numbers. 1574062d2d48Smrg (line 10) 1575062d2d48Smrg* mpc_init3: Initializing Complex Numbers. 1576062d2d48Smrg (line 15) 1577062d2d48Smrg* mpc_inp_str: String and Stream Input and Output. 1578062d2d48Smrg (line 74) 1579062d2d48Smrg* mpc_log: Power Functions and Logarithm. 1580062d2d48Smrg (line 36) 1581062d2d48Smrg* mpc_log10: Power Functions and Logarithm. 1582062d2d48Smrg (line 37) 1583*367b8279Smrg* mpc_mul: Basic Arithmetic. (line 51) 1584*367b8279Smrg* mpc_mul_2si: Basic Arithmetic. (line 109) 1585*367b8279Smrg* mpc_mul_2ui: Basic Arithmetic. (line 107) 1586*367b8279Smrg* mpc_mul_fr: Basic Arithmetic. (line 57) 1587*367b8279Smrg* mpc_mul_i: Basic Arithmetic. (line 63) 1588*367b8279Smrg* mpc_mul_si: Basic Arithmetic. (line 55) 1589*367b8279Smrg* mpc_mul_ui: Basic Arithmetic. (line 53) 1590*367b8279Smrg* mpc_neg: Basic Arithmetic. (line 42) 1591*367b8279Smrg* mpc_norm: Basic Arithmetic. (line 103) 1592062d2d48Smrg* mpc_out_str: String and Stream Input and Output. 1593062d2d48Smrg (line 109) 1594062d2d48Smrg* mpc_pow: Power Functions and Logarithm. 1595062d2d48Smrg (line 11) 1596062d2d48Smrg* mpc_pow_d: Power Functions and Logarithm. 1597062d2d48Smrg (line 13) 1598062d2d48Smrg* mpc_pow_fr: Power Functions and Logarithm. 1599062d2d48Smrg (line 23) 1600062d2d48Smrg* mpc_pow_ld: Power Functions and Logarithm. 1601062d2d48Smrg (line 15) 1602062d2d48Smrg* mpc_pow_si: Power Functions and Logarithm. 1603062d2d48Smrg (line 17) 1604062d2d48Smrg* mpc_pow_ui: Power Functions and Logarithm. 1605062d2d48Smrg (line 19) 1606062d2d48Smrg* mpc_pow_z: Power Functions and Logarithm. 1607062d2d48Smrg (line 21) 1608062d2d48Smrg* mpc_proj: Projection & Decomposing. 1609062d2d48Smrg (line 24) 1610062d2d48Smrg* mpc_real: Projection & Decomposing. 1611062d2d48Smrg (line 6) 1612062d2d48Smrg* mpc_realref: Projection & Decomposing. 1613062d2d48Smrg (line 14) 161439f28e1eSmrg* mpc_rootofunity: Power Functions and Logarithm. 161539f28e1eSmrg (line 44) 1616062d2d48Smrg* mpc_set: Assigning Complex Numbers. 1617062d2d48Smrg (line 16) 1618062d2d48Smrg* mpc_set_d: Assigning Complex Numbers. 1619062d2d48Smrg (line 25) 1620062d2d48Smrg* mpc_set_dc: Assigning Complex Numbers. 1621062d2d48Smrg (line 27) 1622062d2d48Smrg* mpc_set_d_d: Assigning Complex Numbers. 1623062d2d48Smrg (line 54) 1624062d2d48Smrg* mpc_set_f: Assigning Complex Numbers. 1625062d2d48Smrg (line 33) 1626062d2d48Smrg* mpc_set_fr: Assigning Complex Numbers. 1627062d2d48Smrg (line 34) 1628062d2d48Smrg* mpc_set_fr_fr: Assigning Complex Numbers. 1629062d2d48Smrg (line 64) 1630062d2d48Smrg* mpc_set_f_f: Assigning Complex Numbers. 1631062d2d48Smrg (line 62) 1632062d2d48Smrg* mpc_set_ld: Assigning Complex Numbers. 1633062d2d48Smrg (line 26) 1634062d2d48Smrg* mpc_set_ldc: Assigning Complex Numbers. 1635062d2d48Smrg (line 29) 1636062d2d48Smrg* mpc_set_ld_ld: Assigning Complex Numbers. 1637062d2d48Smrg (line 56) 1638062d2d48Smrg* mpc_set_nan: Assigning Complex Numbers. 1639062d2d48Smrg (line 79) 1640062d2d48Smrg* mpc_set_prec: Initializing Complex Numbers. 1641062d2d48Smrg (line 41) 1642062d2d48Smrg* mpc_set_q: Assigning Complex Numbers. 1643062d2d48Smrg (line 32) 1644062d2d48Smrg* mpc_set_q_q: Assigning Complex Numbers. 1645062d2d48Smrg (line 60) 1646062d2d48Smrg* mpc_set_si: Assigning Complex Numbers. 16478fa80f29Smrg (line 22) 1648062d2d48Smrg* mpc_set_si_si: Assigning Complex Numbers. 1649062d2d48Smrg (line 48) 1650062d2d48Smrg* mpc_set_sj: Assigning Complex Numbers. 1651062d2d48Smrg (line 24) 1652062d2d48Smrg* mpc_set_sj_sj: Assigning Complex Numbers. 1653062d2d48Smrg (line 52) 1654062d2d48Smrg* mpc_set_str: String and Stream Input and Output. 1655062d2d48Smrg (line 35) 1656062d2d48Smrg* mpc_set_ui: Assigning Complex Numbers. 1657062d2d48Smrg (line 20) 1658062d2d48Smrg* mpc_set_ui_ui: Assigning Complex Numbers. 1659062d2d48Smrg (line 46) 1660062d2d48Smrg* mpc_set_uj: Assigning Complex Numbers. 1661062d2d48Smrg (line 23) 1662062d2d48Smrg* mpc_set_uj_uj: Assigning Complex Numbers. 1663062d2d48Smrg (line 50) 1664062d2d48Smrg* MPC_SET_X_Y: Advanced Functions. (line 6) 1665062d2d48Smrg* mpc_set_z: Assigning Complex Numbers. 1666062d2d48Smrg (line 31) 1667062d2d48Smrg* mpc_set_z_z: Assigning Complex Numbers. 1668062d2d48Smrg (line 58) 1669062d2d48Smrg* mpc_sin: Trigonometric Functions. 1670062d2d48Smrg (line 6) 1671062d2d48Smrg* mpc_sinh: Trigonometric Functions. 1672a0d373eeSmrg (line 18) 1673062d2d48Smrg* mpc_sin_cos: Trigonometric Functions. 1674a0d373eeSmrg (line 12) 1675*367b8279Smrg* mpc_sqr: Basic Arithmetic. (line 69) 1676062d2d48Smrg* mpc_sqrt: Power Functions and Logarithm. 1677062d2d48Smrg (line 6) 1678062d2d48Smrg* mpc_strtoc: String and Stream Input and Output. 1679062d2d48Smrg (line 6) 1680*367b8279Smrg* mpc_sub: Basic Arithmetic. (line 27) 1681*367b8279Smrg* mpc_sub_fr: Basic Arithmetic. (line 29) 1682*367b8279Smrg* mpc_sub_ui: Basic Arithmetic. (line 33) 1683*367b8279Smrg* mpc_sum: Basic Arithmetic. (line 46) 1684062d2d48Smrg* mpc_swap: Assigning Complex Numbers. 1685062d2d48Smrg (line 82) 1686062d2d48Smrg* mpc_tan: Trigonometric Functions. 1687a0d373eeSmrg (line 8) 1688062d2d48Smrg* mpc_tanh: Trigonometric Functions. 1689a0d373eeSmrg (line 20) 1690*367b8279Smrg* mpc_ui_div: Basic Arithmetic. (line 88) 1691*367b8279Smrg* mpc_ui_sub: Basic Arithmetic. (line 35) 1692*367b8279Smrg* mpc_ui_ui_sub: Basic Arithmetic. (line 37) 1693062d2d48Smrg* mpc_urandom: Miscellaneous Complex Functions. 1694062d2d48Smrg (line 6) 1695062d2d48Smrg* MPC_VERSION: Miscellaneous Complex Functions. 1696062d2d48Smrg (line 17) 1697062d2d48Smrg* MPC_VERSION_MAJOR: Miscellaneous Complex Functions. 1698062d2d48Smrg (line 18) 1699062d2d48Smrg* MPC_VERSION_MINOR: Miscellaneous Complex Functions. 1700062d2d48Smrg (line 19) 1701062d2d48Smrg* MPC_VERSION_NUM: Miscellaneous Complex Functions. 1702062d2d48Smrg (line 36) 1703062d2d48Smrg* MPC_VERSION_PATCHLEVEL: Miscellaneous Complex Functions. 1704062d2d48Smrg (line 20) 1705062d2d48Smrg* MPC_VERSION_STRING: Miscellaneous Complex Functions. 1706062d2d48Smrg (line 21) 1707*367b8279Smrg 1708*367b8279Smrg 1709*367b8279SmrgFile: mpc.info, Node: Type Index, Next: GNU Free Documentation License, Prev: Function Index, Up: Top 1710*367b8279Smrg 1711*367b8279SmrgType Index 1712*367b8279Smrg********** 1713*367b8279Smrg 1714*367b8279Smrg[index] 1715*367b8279Smrg* Menu: 1716*367b8279Smrg 1717*367b8279Smrg* mpcb_ptr: Ball Arithmetic. (line 140) 1718*367b8279Smrg* mpcb_srcptr: Ball Arithmetic. (line 140) 1719*367b8279Smrg* mpcb_t: Ball Arithmetic. (line 11) 1720*367b8279Smrg* mpcb_t <1>: Ball Arithmetic. (line 140) 1721*367b8279Smrg* mpcr_ptr: Ball Arithmetic. (line 28) 1722*367b8279Smrg* mpcr_srcptr: Ball Arithmetic. (line 28) 1723*367b8279Smrg* mpcr_t: Ball Arithmetic. (line 28) 1724*367b8279Smrg* mpc_ptr: GNU MPC Basics. (line 15) 1725*367b8279Smrg* mpc_rnd_t: GNU MPC Basics. (line 24) 1726*367b8279Smrg* mpc_srcptr: GNU MPC Basics. (line 15) 1727*367b8279Smrg* mpc_t: GNU MPC Basics. (line 15) 172839f28e1eSmrg* mpfr_prec_t: GNU MPC Basics. (line 19) 17298fa80f29Smrg 17308fa80f29Smrg 1731*367b8279SmrgFile: mpc.info, Node: GNU Free Documentation License, Prev: Type Index, Up: Top 17328fa80f29Smrg 1733062d2d48SmrgAppendix A GNU Free Documentation License 1734062d2d48Smrg***************************************** 17358fa80f29Smrg 17368fa80f29Smrg Version 1.3, 3 November 2008 17378fa80f29Smrg 1738*367b8279Smrg Copyright © 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. 1739062d2d48Smrg <http://fsf.org/> 17408fa80f29Smrg 17418fa80f29Smrg Everyone is permitted to copy and distribute verbatim copies 17428fa80f29Smrg of this license document, but changing it is not allowed. 17438fa80f29Smrg 17448fa80f29Smrg 0. PREAMBLE 17458fa80f29Smrg 17468fa80f29Smrg The purpose of this License is to make a manual, textbook, or other 1747*367b8279Smrg functional and useful document “free” in the sense of freedom: to 17488fa80f29Smrg assure everyone the effective freedom to copy and redistribute it, 17498fa80f29Smrg with or without modifying it, either commercially or 17508fa80f29Smrg noncommercially. Secondarily, this License preserves for the 17518fa80f29Smrg author and publisher a way to get credit for their work, while not 17528fa80f29Smrg being considered responsible for modifications made by others. 17538fa80f29Smrg 1754*367b8279Smrg This License is a kind of “copyleft”, which means that derivative 17558fa80f29Smrg works of the document must themselves be free in the same sense. 17568fa80f29Smrg It complements the GNU General Public License, which is a copyleft 17578fa80f29Smrg license designed for free software. 17588fa80f29Smrg 17598fa80f29Smrg We have designed this License in order to use it for manuals for 17608fa80f29Smrg free software, because free software needs free documentation: a 17618fa80f29Smrg free program should come with manuals providing the same freedoms 17628fa80f29Smrg that the software does. But this License is not limited to 17638fa80f29Smrg software manuals; it can be used for any textual work, regardless 1764062d2d48Smrg of subject matter or whether it is published as a printed book. We 1765062d2d48Smrg recommend this License principally for works whose purpose is 17668fa80f29Smrg instruction or reference. 17678fa80f29Smrg 17688fa80f29Smrg 1. APPLICABILITY AND DEFINITIONS 17698fa80f29Smrg 17708fa80f29Smrg This License applies to any manual or other work, in any medium, 1771062d2d48Smrg that contains a notice placed by the copyright holder saying it can 1772062d2d48Smrg be distributed under the terms of this License. Such a notice 17738fa80f29Smrg grants a world-wide, royalty-free license, unlimited in duration, 17748fa80f29Smrg to use that work under the conditions stated herein. The 1775*367b8279Smrg “Document”, below, refers to any such manual or work. Any member 1776*367b8279Smrg of the public is a licensee, and is addressed as “you”. You accept 1777062d2d48Smrg the license if you copy, modify or distribute the work in a way 1778062d2d48Smrg requiring permission under copyright law. 17798fa80f29Smrg 1780*367b8279Smrg A “Modified Version” of the Document means any work containing the 17818fa80f29Smrg Document or a portion of it, either copied verbatim, or with 17828fa80f29Smrg modifications and/or translated into another language. 17838fa80f29Smrg 1784*367b8279Smrg A “Secondary Section” is a named appendix or a front-matter section 17858fa80f29Smrg of the Document that deals exclusively with the relationship of the 1786*367b8279Smrg publishers or authors of the Document to the Document’s overall 17878fa80f29Smrg subject (or to related matters) and contains nothing that could 17888fa80f29Smrg fall directly within that overall subject. (Thus, if the Document 17898fa80f29Smrg is in part a textbook of mathematics, a Secondary Section may not 17908fa80f29Smrg explain any mathematics.) The relationship could be a matter of 17918fa80f29Smrg historical connection with the subject or with related matters, or 17928fa80f29Smrg of legal, commercial, philosophical, ethical or political position 17938fa80f29Smrg regarding them. 17948fa80f29Smrg 1795*367b8279Smrg The “Invariant Sections” are certain Secondary Sections whose 1796062d2d48Smrg titles are designated, as being those of Invariant Sections, in the 1797062d2d48Smrg notice that says that the Document is released under this License. 1798062d2d48Smrg If a section does not fit the above definition of Secondary then it 1799062d2d48Smrg is not allowed to be designated as Invariant. The Document may 1800062d2d48Smrg contain zero Invariant Sections. If the Document does not identify 1801062d2d48Smrg any Invariant Sections then there are none. 18028fa80f29Smrg 1803*367b8279Smrg The “Cover Texts” are certain short passages of text that are 18048fa80f29Smrg listed, as Front-Cover Texts or Back-Cover Texts, in the notice 18058fa80f29Smrg that says that the Document is released under this License. A 18068fa80f29Smrg Front-Cover Text may be at most 5 words, and a Back-Cover Text may 18078fa80f29Smrg be at most 25 words. 18088fa80f29Smrg 1809*367b8279Smrg A “Transparent” copy of the Document means a machine-readable copy, 18108fa80f29Smrg represented in a format whose specification is available to the 18118fa80f29Smrg general public, that is suitable for revising the document 1812062d2d48Smrg straightforwardly with generic text editors or (for images composed 1813062d2d48Smrg of pixels) generic paint programs or (for drawings) some widely 1814062d2d48Smrg available drawing editor, and that is suitable for input to text 1815062d2d48Smrg formatters or for automatic translation to a variety of formats 1816062d2d48Smrg suitable for input to text formatters. A copy made in an otherwise 1817062d2d48Smrg Transparent file format whose markup, or absence of markup, has 1818062d2d48Smrg been arranged to thwart or discourage subsequent modification by 1819062d2d48Smrg readers is not Transparent. An image format is not Transparent if 1820062d2d48Smrg used for any substantial amount of text. A copy that is not 1821*367b8279Smrg “Transparent” is called “Opaque”. 18228fa80f29Smrg 18238fa80f29Smrg Examples of suitable formats for Transparent copies include plain 18248fa80f29Smrg ASCII without markup, Texinfo input format, LaTeX input format, 1825062d2d48Smrg SGML or XML using a publicly available DTD, and standard-conforming 1826062d2d48Smrg simple HTML, PostScript or PDF designed for human modification. 1827062d2d48Smrg Examples of transparent image formats include PNG, XCF and JPG. 1828062d2d48Smrg Opaque formats include proprietary formats that can be read and 1829062d2d48Smrg edited only by proprietary word processors, SGML or XML for which 1830062d2d48Smrg the DTD and/or processing tools are not generally available, and 1831062d2d48Smrg the machine-generated HTML, PostScript or PDF produced by some word 1832062d2d48Smrg processors for output purposes only. 18338fa80f29Smrg 1834*367b8279Smrg The “Title Page” means, for a printed book, the title page itself, 18358fa80f29Smrg plus such following pages as are needed to hold, legibly, the 18368fa80f29Smrg material this License requires to appear in the title page. For 1837*367b8279Smrg works in formats which do not have any title page as such, “Title 1838*367b8279Smrg Page” means the text near the most prominent appearance of the 1839*367b8279Smrg work’s title, preceding the beginning of the body of the text. 18408fa80f29Smrg 1841*367b8279Smrg The “publisher” means any person or entity that distributes copies 18428fa80f29Smrg of the Document to the public. 18438fa80f29Smrg 1844*367b8279Smrg A section “Entitled XYZ” means a named subunit of the Document 18458fa80f29Smrg whose title either is precisely XYZ or contains XYZ in parentheses 18468fa80f29Smrg following text that translates XYZ in another language. (Here XYZ 18478fa80f29Smrg stands for a specific section name mentioned below, such as 1848*367b8279Smrg “Acknowledgements”, “Dedications”, “Endorsements”, or “History”.) 1849*367b8279Smrg To “Preserve the Title” of such a section when you modify the 1850*367b8279Smrg Document means that it remains a section “Entitled XYZ” according 18518fa80f29Smrg to this definition. 18528fa80f29Smrg 18538fa80f29Smrg The Document may include Warranty Disclaimers next to the notice 18548fa80f29Smrg which states that this License applies to the Document. These 18558fa80f29Smrg Warranty Disclaimers are considered to be included by reference in 18568fa80f29Smrg this License, but only as regards disclaiming warranties: any other 18578fa80f29Smrg implication that these Warranty Disclaimers may have is void and 18588fa80f29Smrg has no effect on the meaning of this License. 18598fa80f29Smrg 18608fa80f29Smrg 2. VERBATIM COPYING 18618fa80f29Smrg 18628fa80f29Smrg You may copy and distribute the Document in any medium, either 18638fa80f29Smrg commercially or noncommercially, provided that this License, the 18648fa80f29Smrg copyright notices, and the license notice saying this License 18658fa80f29Smrg applies to the Document are reproduced in all copies, and that you 18668fa80f29Smrg add no other conditions whatsoever to those of this License. You 18678fa80f29Smrg may not use technical measures to obstruct or control the reading 18688fa80f29Smrg or further copying of the copies you make or distribute. However, 18698fa80f29Smrg you may accept compensation in exchange for copies. If you 1870062d2d48Smrg distribute a large enough number of copies you must also follow the 1871062d2d48Smrg conditions in section 3. 18728fa80f29Smrg 18738fa80f29Smrg You may also lend copies, under the same conditions stated above, 18748fa80f29Smrg and you may publicly display copies. 18758fa80f29Smrg 18768fa80f29Smrg 3. COPYING IN QUANTITY 18778fa80f29Smrg 18788fa80f29Smrg If you publish printed copies (or copies in media that commonly 18798fa80f29Smrg have printed covers) of the Document, numbering more than 100, and 1880*367b8279Smrg the Document’s license notice requires Cover Texts, you must 18818fa80f29Smrg enclose the copies in covers that carry, clearly and legibly, all 18828fa80f29Smrg these Cover Texts: Front-Cover Texts on the front cover, and 18838fa80f29Smrg Back-Cover Texts on the back cover. Both covers must also clearly 18848fa80f29Smrg and legibly identify you as the publisher of these copies. The 1885062d2d48Smrg front cover must present the full title with all words of the title 1886062d2d48Smrg equally prominent and visible. You may add other material on the 1887062d2d48Smrg covers in addition. Copying with changes limited to the covers, as 1888062d2d48Smrg long as they preserve the title of the Document and satisfy these 1889062d2d48Smrg conditions, can be treated as verbatim copying in other respects. 18908fa80f29Smrg 18918fa80f29Smrg If the required texts for either cover are too voluminous to fit 18928fa80f29Smrg legibly, you should put the first ones listed (as many as fit 18938fa80f29Smrg reasonably) on the actual cover, and continue the rest onto 18948fa80f29Smrg adjacent pages. 18958fa80f29Smrg 18968fa80f29Smrg If you publish or distribute Opaque copies of the Document 1897062d2d48Smrg numbering more than 100, you must either include a machine-readable 1898062d2d48Smrg Transparent copy along with each Opaque copy, or state in or with 1899062d2d48Smrg each Opaque copy a computer-network location from which the general 1900062d2d48Smrg network-using public has access to download using public-standard 1901062d2d48Smrg network protocols a complete Transparent copy of the Document, free 1902062d2d48Smrg of added material. If you use the latter option, you must take 1903062d2d48Smrg reasonably prudent steps, when you begin distribution of Opaque 1904062d2d48Smrg copies in quantity, to ensure that this Transparent copy will 1905062d2d48Smrg remain thus accessible at the stated location until at least one 1906062d2d48Smrg year after the last time you distribute an Opaque copy (directly or 1907062d2d48Smrg through your agents or retailers) of that edition to the public. 19088fa80f29Smrg 19098fa80f29Smrg It is requested, but not required, that you contact the authors of 1910062d2d48Smrg the Document well before redistributing any large number of copies, 1911062d2d48Smrg to give them a chance to provide you with an updated version of the 1912062d2d48Smrg Document. 19138fa80f29Smrg 19148fa80f29Smrg 4. MODIFICATIONS 19158fa80f29Smrg 19168fa80f29Smrg You may copy and distribute a Modified Version of the Document 19178fa80f29Smrg under the conditions of sections 2 and 3 above, provided that you 1918062d2d48Smrg release the Modified Version under precisely this License, with the 1919062d2d48Smrg Modified Version filling the role of the Document, thus licensing 1920062d2d48Smrg distribution and modification of the Modified Version to whoever 1921062d2d48Smrg possesses a copy of it. In addition, you must do these things in 1922062d2d48Smrg the Modified Version: 19238fa80f29Smrg 19248fa80f29Smrg A. Use in the Title Page (and on the covers, if any) a title 1925062d2d48Smrg distinct from that of the Document, and from those of previous 1926062d2d48Smrg versions (which should, if there were any, be listed in the 1927062d2d48Smrg History section of the Document). You may use the same title 1928062d2d48Smrg as a previous version if the original publisher of that 1929062d2d48Smrg version gives permission. 19308fa80f29Smrg 19318fa80f29Smrg B. List on the Title Page, as authors, one or more persons or 19328fa80f29Smrg entities responsible for authorship of the modifications in 19338fa80f29Smrg the Modified Version, together with at least five of the 19348fa80f29Smrg principal authors of the Document (all of its principal 19358fa80f29Smrg authors, if it has fewer than five), unless they release you 19368fa80f29Smrg from this requirement. 19378fa80f29Smrg 19388fa80f29Smrg C. State on the Title page the name of the publisher of the 19398fa80f29Smrg Modified Version, as the publisher. 19408fa80f29Smrg 19418fa80f29Smrg D. Preserve all the copyright notices of the Document. 19428fa80f29Smrg 19438fa80f29Smrg E. Add an appropriate copyright notice for your modifications 19448fa80f29Smrg adjacent to the other copyright notices. 19458fa80f29Smrg 19468fa80f29Smrg F. Include, immediately after the copyright notices, a license 19478fa80f29Smrg notice giving the public permission to use the Modified 19488fa80f29Smrg Version under the terms of this License, in the form shown in 19498fa80f29Smrg the Addendum below. 19508fa80f29Smrg 19518fa80f29Smrg G. Preserve in that license notice the full lists of Invariant 1952*367b8279Smrg Sections and required Cover Texts given in the Document’s 19538fa80f29Smrg license notice. 19548fa80f29Smrg 19558fa80f29Smrg H. Include an unaltered copy of this License. 19568fa80f29Smrg 1957*367b8279Smrg I. Preserve the section Entitled “History”, Preserve its Title, 19588fa80f29Smrg and add to it an item stating at least the title, year, new 1959062d2d48Smrg authors, and publisher of the Modified Version as given on the 1960*367b8279Smrg Title Page. If there is no section Entitled “History” in the 1961062d2d48Smrg Document, create one stating the title, year, authors, and 1962062d2d48Smrg publisher of the Document as given on its Title Page, then add 1963062d2d48Smrg an item describing the Modified Version as stated in the 1964062d2d48Smrg previous sentence. 19658fa80f29Smrg 19668fa80f29Smrg J. Preserve the network location, if any, given in the Document 19678fa80f29Smrg for public access to a Transparent copy of the Document, and 19688fa80f29Smrg likewise the network locations given in the Document for 1969062d2d48Smrg previous versions it was based on. These may be placed in the 1970*367b8279Smrg “History” section. You may omit a network location for a work 1971062d2d48Smrg that was published at least four years before the Document 1972062d2d48Smrg itself, or if the original publisher of the version it refers 1973062d2d48Smrg to gives permission. 19748fa80f29Smrg 1975*367b8279Smrg K. For any section Entitled “Acknowledgements” or “Dedications”, 1976062d2d48Smrg Preserve the Title of the section, and preserve in the section 1977062d2d48Smrg all the substance and tone of each of the contributor 19788fa80f29Smrg acknowledgements and/or dedications given therein. 19798fa80f29Smrg 1980062d2d48Smrg L. Preserve all the Invariant Sections of the Document, unaltered 1981062d2d48Smrg in their text and in their titles. Section numbers or the 1982062d2d48Smrg equivalent are not considered part of the section titles. 19838fa80f29Smrg 1984*367b8279Smrg M. Delete any section Entitled “Endorsements”. Such a section 19858fa80f29Smrg may not be included in the Modified Version. 19868fa80f29Smrg 19878fa80f29Smrg N. Do not retitle any existing section to be Entitled 1988*367b8279Smrg “Endorsements” or to conflict in title with any Invariant 19898fa80f29Smrg Section. 19908fa80f29Smrg 19918fa80f29Smrg O. Preserve any Warranty Disclaimers. 19928fa80f29Smrg 19938fa80f29Smrg If the Modified Version includes new front-matter sections or 19948fa80f29Smrg appendices that qualify as Secondary Sections and contain no 1995062d2d48Smrg material copied from the Document, you may at your option designate 1996062d2d48Smrg some or all of these sections as invariant. To do this, add their 1997*367b8279Smrg titles to the list of Invariant Sections in the Modified Version’s 1998062d2d48Smrg license notice. These titles must be distinct from any other 1999062d2d48Smrg section titles. 20008fa80f29Smrg 2001*367b8279Smrg You may add a section Entitled “Endorsements”, provided it contains 20028fa80f29Smrg nothing but endorsements of your Modified Version by various 2003*367b8279Smrg parties—for example, statements of peer review or that the text has 2004*367b8279Smrg been approved by an organization as the authoritative definition of 2005*367b8279Smrg a standard. 20068fa80f29Smrg 20078fa80f29Smrg You may add a passage of up to five words as a Front-Cover Text, 2008062d2d48Smrg and a passage of up to 25 words as a Back-Cover Text, to the end of 2009062d2d48Smrg the list of Cover Texts in the Modified Version. Only one passage 2010062d2d48Smrg of Front-Cover Text and one of Back-Cover Text may be added by (or 2011062d2d48Smrg through arrangements made by) any one entity. If the Document 2012062d2d48Smrg already includes a cover text for the same cover, previously added 2013062d2d48Smrg by you or by arrangement made by the same entity you are acting on 2014062d2d48Smrg behalf of, you may not add another; but you may replace the old 2015062d2d48Smrg one, on explicit permission from the previous publisher that added 2016062d2d48Smrg the old one. 20178fa80f29Smrg 20188fa80f29Smrg The author(s) and publisher(s) of the Document do not by this 20198fa80f29Smrg License give permission to use their names for publicity for or to 20208fa80f29Smrg assert or imply endorsement of any Modified Version. 20218fa80f29Smrg 20228fa80f29Smrg 5. COMBINING DOCUMENTS 20238fa80f29Smrg 20248fa80f29Smrg You may combine the Document with other documents released under 20258fa80f29Smrg this License, under the terms defined in section 4 above for 2026062d2d48Smrg modified versions, provided that you include in the combination all 2027062d2d48Smrg of the Invariant Sections of all of the original documents, 20288fa80f29Smrg unmodified, and list them all as Invariant Sections of your 20298fa80f29Smrg combined work in its license notice, and that you preserve all 20308fa80f29Smrg their Warranty Disclaimers. 20318fa80f29Smrg 20328fa80f29Smrg The combined work need only contain one copy of this License, and 20338fa80f29Smrg multiple identical Invariant Sections may be replaced with a single 20348fa80f29Smrg copy. If there are multiple Invariant Sections with the same name 20358fa80f29Smrg but different contents, make the title of each such section unique 20368fa80f29Smrg by adding at the end of it, in parentheses, the name of the 20378fa80f29Smrg original author or publisher of that section if known, or else a 20388fa80f29Smrg unique number. Make the same adjustment to the section titles in 20398fa80f29Smrg the list of Invariant Sections in the license notice of the 20408fa80f29Smrg combined work. 20418fa80f29Smrg 20428fa80f29Smrg In the combination, you must combine any sections Entitled 2043*367b8279Smrg “History” in the various original documents, forming one section 2044*367b8279Smrg Entitled “History”; likewise combine any sections Entitled 2045*367b8279Smrg “Acknowledgements”, and any sections Entitled “Dedications”. You 2046*367b8279Smrg must delete all sections Entitled “Endorsements.” 20478fa80f29Smrg 20488fa80f29Smrg 6. COLLECTIONS OF DOCUMENTS 20498fa80f29Smrg 20508fa80f29Smrg You may make a collection consisting of the Document and other 20518fa80f29Smrg documents released under this License, and replace the individual 20528fa80f29Smrg copies of this License in the various documents with a single copy 20538fa80f29Smrg that is included in the collection, provided that you follow the 2054062d2d48Smrg rules of this License for verbatim copying of each of the documents 2055062d2d48Smrg in all other respects. 20568fa80f29Smrg 20578fa80f29Smrg You may extract a single document from such a collection, and 20588fa80f29Smrg distribute it individually under this License, provided you insert 2059062d2d48Smrg a copy of this License into the extracted document, and follow this 2060062d2d48Smrg License in all other respects regarding verbatim copying of that 2061062d2d48Smrg document. 20628fa80f29Smrg 20638fa80f29Smrg 7. AGGREGATION WITH INDEPENDENT WORKS 20648fa80f29Smrg 20658fa80f29Smrg A compilation of the Document or its derivatives with other 2066062d2d48Smrg separate and independent documents or works, in or on a volume of a 2067*367b8279Smrg storage or distribution medium, is called an “aggregate” if the 20688fa80f29Smrg copyright resulting from the compilation is not used to limit the 2069*367b8279Smrg legal rights of the compilation’s users beyond what the individual 20708fa80f29Smrg works permit. When the Document is included in an aggregate, this 20718fa80f29Smrg License does not apply to the other works in the aggregate which 20728fa80f29Smrg are not themselves derivative works of the Document. 20738fa80f29Smrg 20748fa80f29Smrg If the Cover Text requirement of section 3 is applicable to these 20758fa80f29Smrg copies of the Document, then if the Document is less than one half 2076*367b8279Smrg of the entire aggregate, the Document’s Cover Texts may be placed 20778fa80f29Smrg on covers that bracket the Document within the aggregate, or the 20788fa80f29Smrg electronic equivalent of covers if the Document is in electronic 20798fa80f29Smrg form. Otherwise they must appear on printed covers that bracket 20808fa80f29Smrg the whole aggregate. 20818fa80f29Smrg 20828fa80f29Smrg 8. TRANSLATION 20838fa80f29Smrg 20848fa80f29Smrg Translation is considered a kind of modification, so you may 20858fa80f29Smrg distribute translations of the Document under the terms of section 20868fa80f29Smrg 4. Replacing Invariant Sections with translations requires special 20878fa80f29Smrg permission from their copyright holders, but you may include 20888fa80f29Smrg translations of some or all Invariant Sections in addition to the 20898fa80f29Smrg original versions of these Invariant Sections. You may include a 20908fa80f29Smrg translation of this License, and all the license notices in the 20918fa80f29Smrg Document, and any Warranty Disclaimers, provided that you also 20928fa80f29Smrg include the original English version of this License and the 20938fa80f29Smrg original versions of those notices and disclaimers. In case of a 20948fa80f29Smrg disagreement between the translation and the original version of 20958fa80f29Smrg this License or a notice or disclaimer, the original version will 20968fa80f29Smrg prevail. 20978fa80f29Smrg 2098*367b8279Smrg If a section in the Document is Entitled “Acknowledgements”, 2099*367b8279Smrg “Dedications”, or “History”, the requirement (section 4) to 21008fa80f29Smrg Preserve its Title (section 1) will typically require changing the 21018fa80f29Smrg actual title. 21028fa80f29Smrg 21038fa80f29Smrg 9. TERMINATION 21048fa80f29Smrg 21058fa80f29Smrg You may not copy, modify, sublicense, or distribute the Document 21068fa80f29Smrg except as expressly provided under this License. Any attempt 21078fa80f29Smrg otherwise to copy, modify, sublicense, or distribute it is void, 21088fa80f29Smrg and will automatically terminate your rights under this License. 21098fa80f29Smrg 21108fa80f29Smrg However, if you cease all violation of this License, then your 21118fa80f29Smrg license from a particular copyright holder is reinstated (a) 2112062d2d48Smrg provisionally, unless and until the copyright holder explicitly and 2113062d2d48Smrg finally terminates your license, and (b) permanently, if the 21148fa80f29Smrg copyright holder fails to notify you of the violation by some 21158fa80f29Smrg reasonable means prior to 60 days after the cessation. 21168fa80f29Smrg 21178fa80f29Smrg Moreover, your license from a particular copyright holder is 21188fa80f29Smrg reinstated permanently if the copyright holder notifies you of the 21198fa80f29Smrg violation by some reasonable means, this is the first time you have 21208fa80f29Smrg received notice of violation of this License (for any work) from 21218fa80f29Smrg that copyright holder, and you cure the violation prior to 30 days 21228fa80f29Smrg after your receipt of the notice. 21238fa80f29Smrg 21248fa80f29Smrg Termination of your rights under this section does not terminate 2125062d2d48Smrg the licenses of parties who have received copies or rights from you 2126062d2d48Smrg under this License. If your rights have been terminated and not 2127062d2d48Smrg permanently reinstated, receipt of a copy of some or all of the 2128062d2d48Smrg same material does not give you any rights to use it. 21298fa80f29Smrg 21308fa80f29Smrg 10. FUTURE REVISIONS OF THIS LICENSE 21318fa80f29Smrg 21328fa80f29Smrg The Free Software Foundation may publish new, revised versions of 21338fa80f29Smrg the GNU Free Documentation License from time to time. Such new 21348fa80f29Smrg versions will be similar in spirit to the present version, but may 21358fa80f29Smrg differ in detail to address new problems or concerns. See 2136062d2d48Smrg <http://www.gnu.org/copyleft/>. 21378fa80f29Smrg 21388fa80f29Smrg Each version of the License is given a distinguishing version 21398fa80f29Smrg number. If the Document specifies that a particular numbered 2140*367b8279Smrg version of this License “or any later version” applies to it, you 21418fa80f29Smrg have the option of following the terms and conditions either of 21428fa80f29Smrg that specified version or of any later version that has been 2143062d2d48Smrg published (not as a draft) by the Free Software Foundation. If the 2144062d2d48Smrg Document does not specify a version number of this License, you may 2145062d2d48Smrg choose any version ever published (not as a draft) by the Free 2146062d2d48Smrg Software Foundation. If the Document specifies that a proxy can 2147062d2d48Smrg decide which future versions of this License can be used, that 2148*367b8279Smrg proxy’s public statement of acceptance of a version permanently 21498fa80f29Smrg authorizes you to choose that version for the Document. 21508fa80f29Smrg 21518fa80f29Smrg 11. RELICENSING 21528fa80f29Smrg 2153*367b8279Smrg “Massive Multiauthor Collaboration Site” (or “MMC Site”) means any 21548fa80f29Smrg World Wide Web server that publishes copyrightable works and also 21558fa80f29Smrg provides prominent facilities for anybody to edit those works. A 21568fa80f29Smrg public wiki that anybody can edit is an example of such a server. 2157*367b8279Smrg A “Massive Multiauthor Collaboration” (or “MMC”) contained in the 21588fa80f29Smrg site means any set of copyrightable works thus published on the MMC 21598fa80f29Smrg site. 21608fa80f29Smrg 2161*367b8279Smrg “CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 21628fa80f29Smrg license published by Creative Commons Corporation, a not-for-profit 21638fa80f29Smrg corporation with a principal place of business in San Francisco, 21648fa80f29Smrg California, as well as future copyleft versions of that license 21658fa80f29Smrg published by that same organization. 21668fa80f29Smrg 2167*367b8279Smrg “Incorporate” means to publish or republish a Document, in whole or 21688fa80f29Smrg in part, as part of another Document. 21698fa80f29Smrg 2170*367b8279Smrg An MMC is “eligible for relicensing” if it is licensed under this 21718fa80f29Smrg License, and if all works that were first published under this 21728fa80f29Smrg License somewhere other than this MMC, and subsequently 21738fa80f29Smrg incorporated in whole or in part into the MMC, (1) had no cover 21748fa80f29Smrg texts or invariant sections, and (2) were thus incorporated prior 21758fa80f29Smrg to November 1, 2008. 21768fa80f29Smrg 21778fa80f29Smrg The operator of an MMC Site may republish an MMC contained in the 21788fa80f29Smrg site under CC-BY-SA on the same site at any time before August 1, 21798fa80f29Smrg 2009, provided the MMC is eligible for relicensing. 21808fa80f29Smrg 21818fa80f29SmrgADDENDUM: How to use this License for your documents 21828fa80f29Smrg==================================================== 21838fa80f29Smrg 21848fa80f29SmrgTo use this License in a document you have written, include a copy of 21858fa80f29Smrgthe License in the document and put the following copyright and license 21868fa80f29Smrgnotices just after the title page: 21878fa80f29Smrg 21888fa80f29Smrg Copyright (C) YEAR YOUR NAME. 21898fa80f29Smrg Permission is granted to copy, distribute and/or modify this document 21908fa80f29Smrg under the terms of the GNU Free Documentation License, Version 1.3 21918fa80f29Smrg or any later version published by the Free Software Foundation; 21928fa80f29Smrg with no Invariant Sections, no Front-Cover Texts, and no Back-Cover 21938fa80f29Smrg Texts. A copy of the license is included in the section entitled ``GNU 21948fa80f29Smrg Free Documentation License''. 21958fa80f29Smrg 21968fa80f29Smrg If you have Invariant Sections, Front-Cover Texts and Back-Cover 2197*367b8279SmrgTexts, replace the “with...Texts.” line with this: 21988fa80f29Smrg 21998fa80f29Smrg with the Invariant Sections being LIST THEIR TITLES, with 22008fa80f29Smrg the Front-Cover Texts being LIST, and with the Back-Cover Texts 22018fa80f29Smrg being LIST. 22028fa80f29Smrg 22038fa80f29Smrg If you have Invariant Sections without Cover Texts, or some other 22048fa80f29Smrgcombination of the three, merge those two alternatives to suit the 22058fa80f29Smrgsituation. 22068fa80f29Smrg 22078fa80f29Smrg If your document contains nontrivial examples of program code, we 2208062d2d48Smrgrecommend releasing these examples in parallel under your choice of free 2209062d2d48Smrgsoftware license, such as the GNU General Public License, to permit 2210062d2d48Smrgtheir use in free software. 22118fa80f29Smrg 22128fa80f29Smrg 22138fa80f29Smrg 22148fa80f29SmrgTag Table: 2215*367b8279SmrgNode: Top769 2216*367b8279SmrgNode: Copying1550 2217*367b8279SmrgNode: Introduction to GNU MPC2322 2218*367b8279SmrgNode: Installing GNU MPC3041 2219*367b8279SmrgNode: Reporting Bugs8342 2220*367b8279SmrgNode: GNU MPC Basics9689 2221*367b8279SmrgRef: return-value13571 2222*367b8279SmrgNode: Complex Functions15058 2223*367b8279SmrgNode: Initializing Complex Numbers16257 2224*367b8279SmrgNode: Assigning Complex Numbers18684 2225*367b8279SmrgNode: Converting Complex Numbers23230 2226*367b8279SmrgNode: String and Stream Input and Output23869 2227*367b8279SmrgNode: Complex Comparison30607 2228*367b8279SmrgNode: Projection & Decomposing32170 2229*367b8279SmrgNode: Basic Arithmetic33579 2230*367b8279SmrgNode: Power Functions and Logarithm39308 2231*367b8279SmrgNode: Trigonometric Functions42244 2232*367b8279SmrgNode: Modular Functions44199 2233*367b8279SmrgNode: Miscellaneous Complex Functions45034 2234*367b8279SmrgNode: Advanced Functions47240 2235*367b8279SmrgNode: Internals48338 2236*367b8279SmrgNode: Ball Arithmetic48797 2237*367b8279SmrgNode: References66134 2238*367b8279SmrgNode: Concept Index66931 2239*367b8279SmrgNode: Function Index69391 2240*367b8279SmrgNode: Type Index86438 2241*367b8279SmrgNode: GNU Free Documentation License87468 22428fa80f29Smrg 22438fa80f29SmrgEnd Tag Table 224490a8ff21Smrg 224590a8ff21Smrg 224690a8ff21SmrgLocal Variables: 224790a8ff21Smrgcoding: utf-8 224890a8ff21SmrgEnd: 2249