Hi Dafydd, attached is an archive of a few abstractions and a small Python helper script which uses the Python decimal module for calculation of large numbers with py/pyext in pd. Have a look at test.pd - it's pretty self-explaining. It's been a while since i used this and i just realized that the re-conversion of the numbers into pd symbols or lists doesn't deliver all digits for really large results... but i'm pretty sure this is easy to fix by some precision argument to the Decimal type (the conversion is in the _.py script, function any2dec)
gr~~~
PS. I think this requires Python version >= 2.4
Dafydd Hughes schrieb:
Thanks for your help, Mathieu and Roman
As it turns out, while I don't want to perform calculations so much, I do need to translate these long numbers into rotations in Gem, so I need them more or less intact.
Looks like it's Python for the crunching then.
Thanks again!
cheers dafydd
On Dec 21, 2007 3:14 PM, Mathieu Bouchard matju@artengine.ca wrote:
On Fri, 21 Dec 2007, Roman Haefeli wrote:
i assume, you don't want to perform calculations with these big numbers. or better i should say, i hope, because this wouldn't be possible (at least with pd on 32bit machines).
Everything is possible. Try this:
ruby -e "p 3**33333"
If you don't have explicit support for unlimitedly long numbers in a given programming language, you can always add it by yourself in some way, by performing the carries by yourself. For example, it takes N^2 plain multiplications to compute multiplication of two numbers of N digits each, if you do it the obvious way. One such "digit" can actually be a bunch of digits in the base that you'd use if you'd be doing it on paper. For example, Ruby does it using 32 bits as being one "digit" relatively to the way it's done (see also my other mail in this thread). It's best to make it fit with the processor or programming language. If Ruby didn't have it and I wanted to add this feature to Ruby, I'd probably make my digits only 30 bits each or perhaps even 15 bits, for speed and RAM reasons (the way numbers are allocated in the specific case of Ruby).
_ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada