mpfr.info 216 KB

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