You make elementary math sound pretty hard to me ;). I think I got the gist of what you are saying. However, I worked and worked and worked for... oh about an hour before realizing that this was yet another project that would not be a fast, easy solving one. One problem was that in the middle of it I made a careless mistake (used less than instead of greater than) and ran it. Oops... a loop goes on forever.. it caused a system crash. And me, the genius that I am, hadn't bothered to save it yet. Well, then I started again with just multiplication (the other was a simple addition test.. which did work mostly well.. I was just expanding its capabilities to 25 digits from 5 digits and a couple other things). Dang its hard to teach a computer how to multiply! And I am using built in multiplication routines too (interesting... it has to know how to multiply to multiply ;). Anyway, thanks for the suggestion. I've encountered all kinds of problems (aka bugs)... but they are surmountable. One thing, I am using arrays. Think theres a simpler way? I put the code I have so far (don't laugh.. its past 9 and I'm sick and tired [multiple ways] of these 16 hour days) below your post (so you can read it only if you want to). It isn't anywhere near completed (including mac-ish features... which won't be included if that makes sense). I hope to make it into a function that calls something like: Value$$= FN MultiplyContainer(Number$$, Multiply$$) (Number is a string of numbers, which would be converted to an array of numbers, and multiplied by multiply which would be treated the same way, and then returned as a container through value$$... with none of that notation stuff) So, is this what you were talking about? Or am I completely insane? >From: ted <ted@...> >Reply-To: futurebasic@... >To: <futurebasic@...> >Subject: Re: [FB] Re: [XFB] a curiosity with containers >Date: Mon, 25 Sep 2000 13:42:47 -0400 > > >-> The answer you're really looking for is to be found in a minor re-write >of the math runtime or some such arcane bit of stuff in the compiler. I >suspect that this is not for the faint of heart. Certainly not for mine. > >-> The point I was trying to make some time back related to the notion that >a number - like 765, for example - could be represented to us "primitive >selves" as 3 completely distinct variables - '7', '6' and '5' - printed >side by side. In an adding situation - the simplest case, perhaps - the >representation could be mathematically meaningful if the relationship >between the digits - like throwing in the carry - was preserved between any >2 digits and no further than any 2 adjacent digits. You can see how this >method might be used to construct a mathematically correct representation >of >a thousand or million digit number with FB^3 or any other language that >couldn't otherwise possibly handle a digit with that precision. > >-> Imagine - no, construct - a 25 digit number by stuffing a digit between >0 >and 9 into each of 25 variables. Add 1 to that (sort of fictional) number >by >adding 1 to the rightmost digit, saving only the rightmost digit of the >addition in the variable, and adding the carry from that addition to the >next-to-right digit (variable), and so on. You will end up with either 25 >or >26 digits which, when printed right-to-left, faithfully represent the >result >of the addition, while no single variable has a value greater than 9. > >-> If you DIM 1 million bytes, for example, using this method, you can >count >up to 10^1,000,000, which is a number far bigger than FB^3 will allow, both >in magnitude and precision. > >-> This sort of thing can be blindingly fast in assembly language, and >although it is quite common in the little single-chip computers we do here, >you'll need to check with some of those fellows who cling to earth by their >prehensile toes for a Mac-ish version. > >-> Following the same line of reasoning, each digit - if they're bytes - is >not limited to 9, but to 65535. Now 100 digits (if a digit is considered to >be a placeholder in our new base 65535 math) will approach the FB^3 limit >(65535^100 > 4 x 10^481), with something slightly less than 6.5 million >(base 10) digits of resolution. > >-> The exercise in question - 6^6^6 - can be accomplished by writing an >FB^3 >copy of elementary school long (which, in an earlier post, came out as >'log') multiplication. Start with 5 variables stuffed with 4, 6, 6, 5, and >6 >(6^6 = 46656), and a whole bunch more variables allocated and ready to >receive numbers. Multiply the rightmost 6 by 6, and put the rightmost digit >of the answer in where the 6 was (which is still 6). Multiply 5 by 6 (=30) >and add the carried 3 (= 33). Keep the 3 in the second digit, and save the >other 3 for the carry, and so on. Just keep doing it untill it's been done >46656 times, and you're there. > >-> 6^600 will be about 450 digits long. > >-> note that 6 = 10^0.778... , so the problem can be written as: >(10^0.778)^46656 = 10^36298, >which, when it's at home, means that the answer will be 36,300 digits long >in base 10, give or take a few. > >-> Sometime between now and Christmas, I will find (or attempt to >duplicate) >an illustration of the method which I did on a Sinclair ZX80 computer in >the >1970s, which calculated and displayed PI to some 2000 digits, the first >hundred of which were correct according to the blue math tables book. > >-> Remember the blue math tables book? Always had one rolled up inside the >handle of my buggy whip. no.. but ok! :) > >-- >Ted Spencer; ted@... >-- >Schr�dinger's Cat is 65 this year. Or not. begin globals dim gNumbers(999)'regular numbers dim gMNumbers(10)'numbers to multiply them by dim gANumbers(10, 999)'each set of multiplied numbers dim gCarried'carried number dim cntr dim cntr2 dim gHighestNumber(10)'highest place without a 0 end globals window #1,"Multiplication the hard way",(0,0)-(500,500) do inc(cntr) gNumbers(cntr) = -1 if cntr < 11 then gMNumbers(cntr) = -1 gANumbers(1, cntr) = -1 gANumbers(2, cntr) = -1 gANumbers(3, cntr) = -1 gANumbers(4, cntr) = -1 gANumbers(5, cntr) = -1 gANumbers(6, cntr) = -1 gANumbers(7, cntr) = -1 gANumbers(8, cntr) = -1 gANumbers(9, cntr) = -1 gANumbers(10, cntr) = -1 until cntr = 999 or cntr > 999 gNumbers(5) = 4 gNumbers(4) = 6 gNumbers(3) = 6 gNumbers(2) = 5 gNumbers(1) = 6 gMNumbers(5) = 4 gMNumbers(4) = 6 gMNumbers(3) = 6 gMNumbers(2) = 5 gMNumbers(1) = 6 'print numbers cntr = 1000 do dec(cntr) if gNumbers(cntr) > 0 then print gNumbers(cntr); until cntr = 1 or cntr < 1 print print "X "; 'print multiply by numbers cntr = 11 do dec(cntr) if gMNumbers(cntr) > 0 then print gMNumbers(cntr); until cntr = 1 or cntr < 1 print 'get the numbers you need to add together for the multiplication cntr2 = 0 gCarried = 0 do inc(cntr2) cntr = 0 gCarried = 0 do inc(cntr) long if gNumbers(cntr) > 0 gANumbers(cntr2, cntr) = gNumbers(cntr) * gMNumbers(cntr2) gANumbers(cntr2, cntr) = gANumbers(cntr2, cntr) + gCarried gCarried = val(left$(Str$(gANumbers(cntr2, cntr)), 2)) gANumbers(cntr2, cntr) = val(right$(str$(gANumbers(cntr2, cntr)), 1)) end if until gNumbers(cntr) = 0 or cntr = 999 or cntr > 999 until gMNumbers(cntr2 + 1) = 0 or cntr2 = 10 or cntr2 > 10 'find highest place-number cntr2 = 0 do inc(cntr2) cntr = 0 do inc(cntr) if gANumbers(cntr2, cntr) > -1 then gHighestNumber(cntr2) = cntr'it can go 1 more than its place (9X9=81, 2 spots) until gANumbers(cntr2, cntr) = -1 or cntr = 999 or cntr > 999 until cntr2 = 10 or cntr2 > 10 'offset the numbers based on their place value cntr2 = 1 cntr = 0 do inc(cntr2) cntr = 0 do inc(cntr) gANumbers(cntr2, gHighestNumber(cntr2) - cntr + cntr2) = gANumbers(cntr2, gHighestNumber(cntr2) - cntr) print gANumbers(cntr2, gHighestNumber(cntr2) - cntr + cntr2); until cntr = gHighestNumber(cntr2) - 1 or cntr > gHighestNumber(cntr2) - 1 print until cntr2 = 10 or cntr > 10 do handleevents until mouse(_down) *XFB for a reason _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com.