Discussion:
How do I hold Large nums like: 7365209600
(too old to reply)
LarryJ
2008-08-03 05:01:44 UTC
Permalink
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
Bruce Larrabee
2008-08-03 07:47:50 UTC
Permalink
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
Thomas Maeder [TeamB]
2008-08-03 08:14:38 UTC
Permalink
Post by LarryJ
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.
Post by LarryJ
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?
Tom420
2008-08-03 19:27:18 UTC
Permalink
Post by LarryJ
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 :)
Ed Mulroy [TeamB]
2008-08-03 21:57:01 UTC
Permalink
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
Post by LarryJ
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
Loading...