MPFRdefinescustomC-languagetypetorepresentfloating-pointnumber–mpfr_t.Mathematicalmanipulationswithmpfr_t–variablesaredonethroughassembler-look-likefunctions.Forinstance,toaddtwonumbersxandywithresultinzspecialfunctionmpfr_add(z,x,y,GMP_RNDN)shouldbecalled.Toillustratethesituation,let’sconsidertwoversionsoftheSchwefelfunction:
//MPFRC++-versionmprealmpfr_schwefel(mpreal&x){return"418.9829"-x*sin(sqrt(abs(x)));}
MainMPFRC++featuresare:
MPFRC++isunderGNUGeneralPublicLicense(GPL).
Non-freelicensesmayalsobepurchasedfromtheauthor,foruserswhodonotwanttheirprogramsprotectedbytheGPL.
Thenon-freelicensesareforusersthatwishtouseMPFRC++intheirproductsbutareunwillingtoreleasetheirsoftwareundertheGPL(whichwouldrequirethemtoreleasesourcecodeandallowfreeredistribution).Suchuserscanpurchaseanunlimited-uselicensefromtheauthor.Contactauthorformoredetails.
MPFRC++isfreeforusageinfreeprojects.Ifyouintendtouseitincommercialapplicationpleasecontactauthorforpermission.
ExtensionforMATLABwhichallowscomputingwitharbitraryprecision.ItusesclassicOOPtechniques(likeoperatoroverloading)fortightintegrationwithMATLABlanguage&environment.Asaresultmultiprecisionnumbersandmatricescanbeusedin-placeofbuilt-indoubleprecisionones.ThismakespossibletorunexistingMATLABscriptswithanydesiredprecisionwithoutmodificationstocode.
LetmeknowaboutyourprojectsoIcanaddittothelist.
OneofthemostimportantfeaturesthatmakeMPFRC++distinctfromtheothersistreatmentofintermediateresultsduringcalculationofwholemathematicalexpression.
C++decomposesexpressionsintoatomicoperationslike“+”,“*“andstoresitsresultsintemporaryvariablesforfurtherusage.Forexample,expressionx=a*b+c*discalculatedbyC++asfollowing:t1=a*bt2=c*dt3=t1+t2x=t3wheret1,t2,t3aretemporaryvariables,actuallyhiddenfromuser.Inordertogetcorrectfinalvaluesuchintermediateresultsshouldbetreatedcarefullywithenoughprecision.
MainMPFRC++ruleforintermediateresultsisprec(rop)=max(prec(op1),prec(op2)):resultofoperationisstoredwiththemaxoftheprecisionsofoperands.
Thisisthemostnaturalruledictatedbypracticalapplications,suchasnumericaldifferentiation,digitalfilterconvolution,etc.whereinordertoobtaincorrectandaccuratefinalresultintermediatecalculationshavetobedonewithhighaccuracy.
Otherlibrariescalculateintermediateresultswiththeprecisionoffinalvariableorroundthemtosomenotobvioustouserprecisionwhichisindependentfromprecisionofargumentsaswellasfromprecisionoffinalvariable.Thiscouldleadtoasignificantreductionintheaccuracyofthefinalresult.
MysinceregratitudegoestothecreatorsofMPFRformakingtheirlibraryavailable,BrianGladmanformakingMPFRandMPIR(GMP)portsforWindows,numerouscontributors,testersandthosehowprovidefeedbackonMPFRC++usageintheirprojects.
April11,2010:
November8,2010:
October5,2010:
July15,2010:
June15,2010:
May21,2010:
August31,2009:
May11,2009:
March9,2009:
November18,2008:
October1,2008:
September30,2008:
September29th,2008:
September4th,2008:
August15th,2008:
August14th,2008:
August11th,2008:
August8th,2008:
August5th,2008:
August4th,2008:
July11th,2008:Projectstart.
Youremailisneverpublishednorshared.
UsenativeLaTeXsyntaxtoincludeformulas:$...$,\[...\],etc.Donotforgettopreviewcommentbeforeposting.