[PD] Long long numbers

Mathieu Bouchard matju at artengine.ca
Fri Dec 21 21:14:02 CET 2007


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


More information about the Pd-list mailing list