Board index » cppbuilder » How do I hold Large nums like: 7365209600

How do I hold Large nums like: 7365209600


2008-08-03 01:01:44 PM
cppbuilder84
I need to create an array that can hold the volume number from the Dow Jones
Industrial Average daily stock trading. A few sample numbers are below.
These are two large for an int. What is the best way to hold these numbers?
7365209600
6705830000
5631330000
5346050000
Thanks
Larry Johnson
 
 

Re:How do I hold Large nums like: 7365209600

Hi LarryJ,
__int32 i32 __int32 i = 123456789i32; 32 bits
__int64 i64 __int64 big = 12345654321i64; 64 bits
unsigned __int64 ui64 unsigned __int64 hugeInt = 1234567887654321ui64; 64 bits
HTH,
Bruce
 

Re:How do I hold Large nums like: 7365209600

"LarryJ" < XXXX@XXXXX.COM >writes:
Quote
I need to create an array that can hold the volume number from the
Dow Jones Industrial Average daily stock trading. A few sample
numbers are below. These are two large for an int.
And even too large for 32bit unsigned int.
Quote
What is the best way to hold these numbers?


7365209600
6705830000
5631330000
5346050000
Maybe this is too obvious, but what about dividing them by 100?
 

{smallsort}

Re:How do I hold Large nums like: 7365209600

LarryJ wrote:
Quote
7365209600
6705830000
5631330000
5346050000
You could use 64-bit integers. Those are slightly slower to process on a
32-bit processor, but that should not be a problem if you are now
processing millions of them every second.
You could use __int64 type (possibly modified by 'unsigned')
Alternatively, you could user a 'double', which can hold up to 15
significant digits. Of course, using a floating point data type for non
floating point data causes overhead, but it's a possibility.
The choice would be based on how you receive and store the numbers, as
some functions are not designed to deal with such data types. Also, it
depends of what exactly you have to do with the numbers (mathematical
manipulation).
Hope it helps,
Tom :)
 

Re:How do I hold Large nums like: 7365209600

As I understand it the volume numbers are derived from the number of lots of
100 stocks so are always multiples of 100 shares. The sole exception is
Berkshire Hathaway class A (BRK.A) for whom a lot is 10 shares but the
volume of that stock is insignificant compared to that of almost any other
and it is not a component of the Dow Jones Industrial Average.
Divide the numbers by 100 to get the number of lots and use int64 and you
should be fine.
. Ed
Quote
LarryJ wrote in message
news:48953b7a$ XXXX@XXXXX.COM ...

I need to create an array that can hold the volume number from the Dow
Jones Industrial Average daily stock trading. A few sample numbers are
below. These are two large for an int. What is the best way to hold these
numbers?

7365209600
6705830000
5631330000
5346050000