labs.beatcraft.com
OS X

Installing bigfloat on Mac OS X

About bigfloat

bigfloat is a Python extension module, which provides arbitrary-precision correctly-rounded binary floating-point arithmetic. This Python module is designed to work for the MPFR library.

For the details, please visit the URL shown below.
https://pypi.python.org/pypi/bigfloat/0.3.0a2

Installing bigfloat on Mac OS X

To install bigfloat, pip is required. Please install pip before starting this installation process. The details of how to install pip, please visit this page. In this article, Mac OS X 10.9.3 is used.

The command for installing bigfloat and installation process are shown below.

$ sudo pip install bigfloat
Downloading/unpacking bigfloat
  Downloading bigfloat-0.2.1.tar.gz (129kB): 129kB downloaded
  Running setup.py (path:/private/tmp/pip_build_root/bigfloat/setup.py) egg_info for package bigfloat
     
Installing collected packages: bigfloat
  Running setup.py install for bigfloat
    
Successfully installed bigfloat
Cleaning up...

To examine whether the installation process is successful or not, please try a sample program, which is listed on the page of bigfloat. This article tests a sample program called a quick tour.

$ python
Python 2.7.5 (default, Mar  9 2014, 22:15:05) 
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from bigfloat import *
>>> BigFloat(1)
BigFloat.exact('1.0000000000000000', precision=53)
>>> BigFloat('3.141592')
BigFloat.exact('3.1415920000000002', precision=53)
>>> BigFloat('3.14159') ** 2 / 6.0
BigFloat.exact('1.6449312880166664', precision=53)
>>> BigFloat('0.1',precision(200))
BigFloat.exact('0.10000000000000000000000000000000000000000000000000000000000002', precision=200)
>>> with precision(10000):
...     print sqrt(2)
... 
1.41421356237309504880168872420969807856967187537694807317667973799073247846210703885038753432764157273501384623091229702492483605\
5850737212644121497099935831413222665927505592755799950501152782060571470109559971605970274534596862014728517418640889198609552329\
2304843087143214508397626036279952514079896872533965463318088296406206152583523950547457502877599617298355752203375318570113543746\
0340849884716038689997069900481503054402779031645424782306849293691862158057846311159666871301301561856898723723528850926486124949\
7715421833420428568606014682472077143585487415565706967765372022648544701585880162075847492265722600208558446652145839889394437092\
6591800311388246468157082630100594858704003186480342194897278290641045072636881313739855256117322040245091227700226941127573627280\
4957381089675040183698683684507257993647290607629969413804756548237289971803268024744206292691248590521810044598421505911202494413\
4172853147810580360337107730918286931471017111168391658172688941975871658215212822951848847208969463386289156288276595263514054226\
7653239694617511291602408715510135150455381287560052631468017127402653969470240300517495318862925631385188163478001569369176881852\
3786840522878376293892143006558695686859645951555016447245098368960368873231143894155766510408839142923381132060524336294853170499\
1577175622854974143899918802176243096520656421182731672625753959471725593463723863226148274262220867115583959992652117625269891754\
0988159348640083457085181472231814204070426509056532333398436457865796796519267292399875366617215982578860263363617827495994219403\
7777536814262177387991945513972312740668983299898953867288228563786977496625199665835257761989393228453447356947949629521688914854\
9253890475582883452609652409654288939453864662574492755638196441031697983306185201937938494005715633372054806854057586799967012137\
2239475821426306585132217408832382947287617393647467837431960001592188807347857617252211867490424977366929207311096369721608933708\
6611567345853348332952546758516447107578486024636008344491148185876555542864551233142199263113325179706084365597043528564100879185\
0076036100915946567067688360557174007675690509613671940132493560524018599910506210816359772643138060546701029356997104242510578174\
9531057255934984451126922780344913506637568747760283162829605532422426957534529028838768446429173282770888318087025339852338122749\
9908123718925407264753678503048215918018861671089728692292011975998807038185433325364602110822992792930728717807998880991767417741\
0898306080032631181642798823117154363869661702999934161614878686018045505553986913115186010386375325004558186044804075024119518430\
5674533683613674597374423988553285179308960373898915173195874134428817842125021916951875593444387396189314549999906107587049090260\
8835176362247497578588583680374579311573398020999866221869499225959132764236194105921003280261498745665996888740679561673918595728\
8864247346358588686449682238600698335264279905628316561391394255764906206518602164726303336297507569787060660685649816009271870929\
21531323682813569889376
>>>


if you obtain the same results as shown above, bigfloat has been successfully installed.

Revision History

  • 2015/01/06 This article is initially uploaded

Front page   Edit Freeze Diff Backup Upload Copy Rename Reload   New List of pages Search Recent changes   RSS of recent changes
Last-modified: 2015-01-06 (Tue) 07:11:40 (3404d)