08-13-2003, 05:38 AM
Yeah, unsigned integer arrays are better than strings for long numbers. I'll tell you why.
With every character added (1 byte long), the number that you can have is 10 times bigger, as every character is a new figure in a base-10 number (this is very similar to "BCD").
Using unsigned integer arrays, your number is just like you appended all your integers binarily. That is, if you array has two integers, your resulting number would be in the range of a long, and so forth. Wich every integer added (2 bytes long), the number that you can have is 65536 times bigger.
To make a comparison, using 4 bytes you can represent a number up to 9999 using strings and up to 4Gigs (more than 4,000,000,000) using unsigned integer arrays.
With every character added (1 byte long), the number that you can have is 10 times bigger, as every character is a new figure in a base-10 number (this is very similar to "BCD").
Using unsigned integer arrays, your number is just like you appended all your integers binarily. That is, if you array has two integers, your resulting number would be in the range of a long, and so forth. Wich every integer added (2 bytes long), the number that you can have is 65536 times bigger.
To make a comparison, using 4 bytes you can represent a number up to 9999 using strings and up to 4Gigs (more than 4,000,000,000) using unsigned integer arrays.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i