What an absurd line of reasoning. Are you actually this clueless, > or
just trolling?
So you've come up with another exception. No-one is claiming that never ever
will you need a number over 4 billion. Clearly, if you need to give an id
number to the entire population of the world, or you need to tag every US
cent in circulation, or you are doing some fancy statistical work that
generates large integers, then these are exceptions. However the exceptions
don't arise very often, which is why you will seldom see long long used in
real programs.
It doesn't take big finances to come up with numbers to overflow a
32-bit integer.
Dollar amounts are best represented as integer quantities of cents,
(assuming you are using integers at all, and you're using dollars),
since accountants like the books to balance exactly. It is often
necessary to use signed numbers for accounting purposes (revenue
and expense, profit and loss). Now you're down to a range of +/-
$20 million. Gas stations, which traditionally have prices ending
in "and nine-tenths of a cent per gallon" might be using integer
quantities of tenths of a cent.
A grocery store (a SINGLE STORE, not a chain) with 10 employees
earning $30,000 annual salary average and margins of 1% (profit
margins tend to be thin in the grocery business) needs to have
revenue of $30 million/year just to support the employees (which
overflows). That money tends to show up on the books multiple times
(e.g. sales of products and purchases of products from vendors).
As grocery stores go, one with only 10 employees is a lot smaller
than most of the ones around here.
Lifetime earnings of some individual higher-paid people (such as
top executives and major-league baseball players) of over $500,000
per year over 40 years would exceed the +/- $20 million limit.
Further, intermediate results often require more range than the
final results do. For example, to calculate sales tax using integer
math, you might multiply by 8,625 and divide by 100,000, then round
(using the peculiar legally-mandated method of rounding for sales
tax, which does not necessarily coincide with any method used by
mathematics.) Suddenly, you overflow this at slightly over $2318,
which isn't even the price of a single good used car. Granted, for
this example, you *CAN* cancel out common factors of 8625 and 100000,
but that 8.625% number is something the state gives you and keeps
changing, and sooner or later they'll give you a prime number. Even
then, you overflow the calculation at something under $300,000.
Gordon L. Burditt