How big is a long int ?

mike-davies

New member
Local time
Today, 16:02
Joined
Nov 19, 2006
Messages
5
I need to know how big a number I can hold in a "Long Integer". The only documentation I can find says it's roughly +/- 2 billion.

Is that a USA billion (10^9)or a UK billion (10^12) ?

I'm guessing it's a 32bit number so that would be a USA billion. Can anyone confirm this ?
 
From Access' help file on FieldSize Property

Long Integer
Stores numbers from –2,147,483,648 to 2,147,483,647 (no fractions).
.
 
yes that is USA billion
 
4 byte number, positive and negative so word +- 2^31 -1 I think,

which is unfortunately not quite big enough to use for integer accounting purposes (ie in pence or cents) so you have to use doubles which introduces some digital rounding implications.
 
Gemma,
I would think that the Currency data type would be better then either floating point data types.
 
i tried to implement an accounting system many moons ago, using longs (ie so all transactions could be held in pence with no roundings

the trouble was that 2,147,483,647 pence equated to 21,474,836.47 which potentially was not big enough.

its just that all other real number formats introduce errors, which you can often see in currency comparisons

eg trying to say if x = y, when there may be tiny differences in the order of eg 2^-10 or smaller
 
From VBA Help:
Currency variables are stored as 64-bit (8-byte) numbers in an integer format, scaled by 10,000 to give a fixed-point number with 15 digits to the left of the decimal point and 4 digits to the right. This representation provides a range of -922,337,203,685,477.5808 to 922,337,203,685,477.5807.
That seems like a sufficiently large and small enough value to work.
 

Users who are viewing this thread

Back
Top Bottom