lua-users home
lua-l archive

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

Hi Lua list!

I would like to use Lua in a "financial" context, where using "doubles" for floating point decimal numbers is not enough regarding to precision.
Indeed, dealing with large monetary values may trigger overflows in the calculations... I certainly do not want this to happen.

Is there a way, using the LNUM patch, to circumvent this? I have thought about using an int64 for numbers and associating a second number to indicate where the decimal point is located. Another option would be to use BCD like some databases do (ORACLE for instance) to deal with arbitrary precision decimals.

What do you think? Is LNUM the way to go (with some improvements), or should I instead use some available BCD library? (or implement it by myself).

Thanks for any insight.

Votre contact a choisi Hotmail, l'e-mail ultra sécurisé. Créez un compte gratuitement !