From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Simon Riggs <simon(at)2ndquadrant(dot)com>, pgsql-patches(at)postgresql(dot)org |
Subject: | Re: Numeric 508 datatype |
Date: | 2005-12-02 19:09:08 |
Message-ID: | 200512021909.jB2J98M03989@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers pgsql-patches |
Uh, I tried factorial(4000) and for display I got:
182880195151406501331474317557391904421737771073043921970645269542089597979731773648503702868704841073364430415692855717546724618615435573339426156179569967167452848315973174988187609374828049804195765129487206105589281297880978006205934295377053267406244538842850917439517567461444473623787224694361945759295799001142129733606589980739777146972612050486637259363374904040660979666371702540213488009442803422853559466496813162601634597438035771759033947331700768417647790821668911845293242300334141454978018325982185184065522570973925300245827389829191044067821687088714956035019058673999662987985348777479231791957914165044080548789747703086507071208788376249865760733404494148545783673833017157063581941274008498556040804733051968334824080794209642751875388891152966555223977239248871546248106597883210056205583696047786579047719183880543192515139819542967416884472461850212504022250101164330168185880366901801776914617797131043016403957082747347011867727569660646110236565287651387357041908762006971458046921252368210668053371752206057453775574525922086539398532785238414483140265488023098603910879397832189461295826479284307399855548838061987498316336401962112027560860160391716077440787768762196616037027594548879452476057492055434640958836645149602938732448424098038014805666001244152937898314963095541171138885615694943149261344704775135164165601029840587519062088655701836838507913173957028613508214646536004694432790777339785687114042447740895092167279225106609414117164124674434454140011889159665472837739886707397928188973147620825689140419522117791940553114052591585389323887452923243868268301359048864722922899938484822892543076284676145232925192226876891802197883771840052462908967032605249103621366273211359765153585281501437967981168362630532297339716122751848961395396131293290084492147231967037891198209712059221955139155468147047786823734877189465608228116230388538870543573162906223784723220453166394184917985170772758396375254276014529618356744844344988856988406924685508257651316109259665853395618544561542290482957422747251262187997454480313918262952211143818906006832084415580882712286180065890594441088066529927878546344974871586757709834226109365906006271705009724813994441453985227568706260972502302291957992772999218449547156908832425535692566571325156635449318303933175188289864439421389716091426213976468083518096946037348729779841480026999651378704481998661671629492564350404161468868239421444591051750334883958699104052075213290168426731685638375315189183396277240661529336272367305611554182278886735139374545081038261028277061215603309060164041624200513733136545701111020033195778785022169191701120746087228523767999431915904806516239580629828294520352271190365024265837525121998240897256117110591539354344189851092414041350690471095275147306485020646304313711859225230369416210263927838134355401958005319886454303447452988456400170827326232488384737716034783363266625792191376014226320576487588079352339155275628179423786752439198868000562094347314076856919423270924641011362547954991593511035427477234345444363663131049963736616549894654981808927164628050422270382221047840626260274801515673778418213162920952956863686193004178633275307643013230819024359711659251635132255111762589194716734375533209349169105739990209660872076631338715165303917875357554203481745199540130159991933352050325711764601050057161153057486693646826752650143102232717628076202428056174355949278906764089530573848907196812258404003966981556247938888161565850436047829617049713977649594047513584458569145819571865335732076903558941507766477279941564256419537555177279654860966753842222323441855372798887805708540920842219936607611547883597774397984908511480312751237592867932246601885937688972917491803572971856504307350631260352783217496299957022001157223866000467728830189631662734637151868125433561735503412333101756008177714471706565175053852587720690671396654785062638983805263943882180363887689991615386454329321164711463925629922042594508892919282617805319256181483111512590885198697876379136078660799208307814332752984685342485954714853544207940898546931676443201159004044444712
and did factorial(6000) and see:
268399976572673959611631664746273551220501860468847256858242614456610709658685788594794097483463298361827030891288526326099395831604692015266370347869763966250758258875295848788615239847022662960185954275515801746542169234248956445498097321653975495002879600970444367760980971122859359020023183008177660749446398654191572805247906532032902539173561336339939785357602530693575551422196691299983170265180324028107514480105574840042547452741402638372101223251070623789275754151796407983255989209077389689634265538335191680339200971398676973450160815636763744412386642130802136662569290977913751994853502315954564979001492027467287553278798129715463733693706773857003416731922853609101127286793852057197105805836413716718924479768188292438178887547214489628871232322684249607541476504824159030266067904672098495636622714169522826493225987513978025239843199202535945837220824550067533621599059257410549700397263292773107837783018961116396473891051895246957317480397448313301711948498137501421985916613313677318972708276426636501211541798449272458694554528660905408695501946189847436491277565405953291476966829310127398586112042831345221430829782552000483383182291153826750774350110211222036572082966453541007117842465371083764279368883320838538657325445624710224662094282623678927668138225862387308841866706405996811552030532635792612643270369483840887567027622533066713611166970068436428344437921870681849674153297625433304802646941320010915365936588697883898144809271168852151697567870735519106890192837508950174932281111167303108281667660412005310563821643233905397132951167413884839677453056917865379413323398186679176765713700074193977734752619438945140523129322896246617698780123506764949477308668319248045528511977593451912540816314647384162691477898479638182122811558965504271703872859804604909516454412434978145140029728337310206814260951601497781410375736884915214425224285447889693895582787613974813482188771577391131805341100500232121264194386991727261544256550362495091543418463532461157575716553971729978886225152177256813555070098051132424613434627496714527886380771247504457759237254918078579046960158898105829151092672132122153152037131592086496741649797197273129205765115591964706021743613038992316498949125108561858147409172262391720725462015395849060504522468632113009485442625506623105299842269925826510851512148068627375440376241841700924369084385977739093116508393021241067435397561337014305498228351759791196475430817743347578460256487782755679664090171158282392788386089643981353002195923088605647717413703528027213285441960352032589136772883045832920269026502920226152339494774542473806139137272059629788082668430781817825215292956631787233099675515123199855701146059750816753705446068330515181719059082252289813159988885086413837541106841617105403795738627508478475051189321086873431162595048827079153319683349897664762150944390327639338292582968256008076593833963316569163794513447848024498992277763357233477663906896662419631703673933912108212320428083024732640632655701107277198314756895614049678770664304299038488801938643778814462182315714396317585684284639471481188587178099037484342226839564520436636188623810771667361639041436117718763725315902967260230353306737999520669241055296022230466287592454208018267220839809215680052112392508181570447124439985770512016943866666765484591390595349556034523324980915614115728536228512670733960540990149693668014945277065375953041388484806644767705332650903626423313863286739125786192092551628124455898401566515763784483104702008872999433928784349649981676639778828872212630963066247193525702160175379019190959971744914238250769159018448282997288670683589328931738555813393831524322836759323091391080868465062163708660330806215238405311467559340973074082156970244090516876036687772268068304154337954105931408904169310310580843570395681027026389994942257493794275398994779012537285255893335279592775544415882679886419718766728485222788854329500007131747178185641199051879252260306500569972158326067559151393339879121574198423317442886428899625776225591734610920613377827928006698899986559608527469421131645773273348845767558137
Both are 4096 characters.
You are right the log() works fine:
test=> select log(factorial(4000));
log
------------------------
12673.2621666764869773
(1 row)
test=> select log(factorial(6000));
log
--------------------
20065.428782473590
(1 row)
I tried your \g test and the file size difference is the length of the
dashed line in the file, not the number of digits display, which are
both 4096. One has 12550 dashes, the other 19950 dashes.
However, my 'wc' sizes are differnt from yours:
5 4 20881 /rtmp/4000
5 4 28273 /rtmp/6000
I ran your SELECT pow(10::numeric, 131071), and gain, 4096 0's are
displayed on my screen. SELECT pow(10::numeric, 7000) and SELECT
pow(10::numeric, 10000) generate identical displays on my screen.
I am even more confused.
---------------------------------------------------------------------------
Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Sorry, I am confused. If our computational range is that high, why does
> > SELECT factorial(4000) and SELECT factorial(6000) produce the same
> > number of digits on my screen.
>
> Are you counting correctly?
>
> regression=# select log(factorial(4000));
> log
> ------------------------
> 12673.2621666764869773
> (1 row)
>
> regression=# select log(factorial(6000));
> log
> --------------------
> 20065.428782473590
> (1 row)
>
> regression=# select factorial(4000)
> regression-# \g z4000
> regression=# select factorial(6000)
> regression-# \g z6000
> regression=# \q
> $ wc z4000 z6000
> 5 5 38039 z4000
> 5 5 60215 z6000
>
> The actual representation limit at the moment (with int16 weights in the
> storable format) is 10^128K, as you can soon prove with pow():
>
> regression=# select pow(10::numeric, 131071);
> << lots o zeroes >>
> regression=# select pow(10::numeric, 131072);
> ERROR: value overflows numeric format
>
> I don't recall what factorial that might correspond to, but it's
> considerably above 6000.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 2005-12-02 19:28:53 | Re: Slow COUNT |
Previous Message | Jaime Casanova | 2005-12-02 19:02:27 | Re: Slow COUNT |
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Sabino Mullane | 2005-12-02 19:37:36 | Re: What`s wrong with the lists? |
Previous Message | Joshua D. Drake | 2005-12-02 19:01:05 | Re: [HACKERS] Should libedit be preferred to libreadline? |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2005-12-02 19:53:47 | Re: Numeric 508 datatype |
Previous Message | Joshua D. Drake | 2005-12-02 19:01:05 | Re: [HACKERS] Should libedit be preferred to libreadline? |