lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


>Financial calculations are usually done in tenths of cents.

If you use doubles the input data should be checked to make sure there are
only 2 (or 3, if required) places past the decimal. Similar for using
cents.

> 23bit, completely insufficient.  So let's hope we are talking about
"double" instead.

Sorry! Of course I meant double, the native Lua number type.

> If we are looking at tenth of cents, an IEEE double will take us all the
way to 2^53-1, which is 9007199254740991, namely $9,007,199,254,740.991.
That's not even a safety margin of 2 for the current gross deficit.

I stand corrected. I therefore agree, if you need to deal with REALLY
large financial transactions, you need something better than a double.

For almost all apps, A double should be fine, using one of the two
techniques I outlined.

Thanks for the corrections!

Glen.