If its going to be string anyway why bother with binary system, why dont
make it decimal natively?

Because binary calculations are much quicker and more mechanical.

On the subject of which, another method is to make use of an array of larger integers, and use bit-shifting/adding operations, which are likely to be faster (not that I've tested them). I don't know what is done in 'proper' BigInt classes, but I'd imagine it's something like that.

For example, to multiply such an array by 3, you'd shift the entire array left by one place and add it to itself, something like this:

0010,1100,1111 * 3 = 0101,1001,1110 + 0010,1100,1111 = 0111, 10101, 11101

And finally you'd carry the extra bits across to make a new array with the same bit size:

... = 1110, 0110, 1101


Danny
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to