On 06/10/18 20:15, Santiago A. wrote: >> places, so can't use Currency data type. > 6 decimals, no currency that's a problem ;-)
Yeah, tell me about it. > you must specify : "Discount will be applied to each item". > 64bits is a lot of precision, but don't be overconfident, even in such > case errors can skyrocket with divisions with small divisors and/or a > lot of operations. Comparing to zero is always dangerous, you'd better > round the number to 6 decimals before comparing. The product I work on is Royalties and Licensing across the globe for very large and medium sized companies. A single contract can span millions to billions of accounting lines, then you have to calculate royalties on all those and make sure afterwards that adding them all up still equals the original amounts. A huge pain and very lengthy process. If it was up to me, I would have opted to converted all amounts to integers as early as possible, do the calculations and then divide by the correct amount to get the decimals required for reporting purposes. But then, this product was developed long before I joined the company, and changing it now would be a mammoth task. So for now, I've got to work with what I've got - as most of us has to do. ;-) Regards, Graeme -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal