
Sorry fot the time shift effect on my mail.Had forgotten Doug's ldecnumber module, which seems The way of doing this.
Asko Kauppi kirjoitti 15.4.2008 kello 8:23:
The original LNUM had also a BCD mode, which was removed for simplicity. I wanted to see, how far the number modes concept could go, and drew a line between complex (included, since C99 offers great help on this) and BCD (which would need lots of code, or outside library).If there's a good enough, free BCD library out there, adding it to LNUM would not be too hard.In my opinion, the number of decimals should be a compile time option (i.e. DLNUM_BCD_DECIMALS=5).Most likely, all mathematics should be BCD in such a mode. No floating point usage, whatsoever. Right? Otherwise, I'd simply recommend doing BCD as an addon Lua side module.( Oh, and instead of BCD of course it would use fixed point decimal. BCD is just a loose storage form, which does not provide benefits in this case, to my understanding. )asko Aladdin Lampé kirjoitti 14.4.2008 kello 20:38: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. Aladdin _________________________________________________________________Votre contact a choisi Hotmail, l'email ultra sécurisé. Créez un compte gratuitement !http://www.windowslive.fr/hotmail/default.asp