#### Archived

This topic is now archived and is closed to further replies.

# More efficient number storage?

This topic is 6966 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

quote:
Original post by Eric

Actually, Milo, I heard kiren_j''s compression algorithm is based on this system...

I thought he was inputting these number sequences obtained from here as a non-dynamic quadrafoil fluidic with a disengaged hypnotic stress level test???

Hmmm, maybe I need coffee.

##### Share on other sites
I see my mistake.... dang it! I thought I had something that might actually be useful for a while... You can still use it to store huge numbers though.

--------------------

You are not a real programmer until you end all your sentences with semicolons;

##### Share on other sites
Yanroy...I''m really sorry to burst your bubble, but you don''t gain anything by using this class over a long (signed or unsigned). In fact, you lose efficiency. Sorry bud. Keep working, though.

##### Share on other sites
Sorry to say, as is, you gain nothing with this code. Each byte (unsigned char) has one of 256 possible values. You have four bytes, therefore there are a total of 256^4 possible values. 256^4 == (2^8)^4 == 2^32. You have just recreated the 32-bit integer.

However, if you extend your array to more than four bytes (say 8 bytes, 16 bytes, or even 256 bytes or more!), then you can do what you''re looking for. For example, let''s say you used an array of 16 bytes. Total combos == 256^16 == (2^8)^16 == 2^128. You can now store (unsigned) integers from 0 to (2^128)-1.

Also, if you extend your arrays, your GetValue() will no longer work. Aside from the fact that you''ll probably lose a good chunk of information converting to doubles. You are better off overloading operators on BigNum to do your calculations.

---- --- -- -

• 10
• 10
• 12
• 17
• 33