Variables

Started by
4 comments, last by izhbq412 19 years, 4 months ago
Just a short question: Is it possible to define a variable with xyz bytes? I want to make a program that deals with a very large number, but normal integers just don't go that far. :( Thanks, ~Dakar
Advertisement
What programming language are you using?
If you're using Java, there's a class that handles just what you speak of BigInteger, I believe.


FOR C/C++:

Also, you can use a dynamically allocated array with each element being an integer if you need a huge amount of space. You can also store the integer in a regular array, also.

If you do either of the above, you'll need to create a function that stores and retrieves the information within the array.
I WISH SOMEONE WOULD FIX THE DAMNED LOGIN!
Sorry, I was using C++.

Okay, that should probably do it. Thanks.
Rather than doing it manually, you should probably look for an existing arbitrary precision computation library. Here's a fairly good link on arbitrary precision computation. At the bottom of that page there are some links to premade multi-precision packages.
If you can afford to lose precision you could also try using a double.
_______________The essence of balance is detachment. To embrace a cause, to grow fond or spiteful, is to lose one''s balance after which, no action can be trusted. Our burden is not for the dependent of spirit. - Mayar, Third Keeper

This topic is closed to new replies.

Advertisement