[fpc-pascal] Currency and ABS(-674.59)

Graeme Geldenhuys graemeg.lists at gmail.com
Fri Mar 9 08:58:16 CET 2012


On 8 March 2012 14:14, Marcos Douglas wrote:
>
> So, if you have two values to storage (amount of decimals is 4) e.g.
> 100.34524 and 2,000.2 you do:
> 100.34524 = 1003452
> 2,000.2 = 20002000


Correct.

We then implemented our own function [eg: M2AmountToCurr() ] which
formats such a number [only when it needs to be displayed] into
something the end-user would understand, and using whatever formatting
style (based on locale or defined by system admin) and defined decimal
count. We also have our own rounding function [when converting
floating point to integer] - adhering to the specifications defined by
our finance department.


> I never heard about this technique before. Very good!

Yes, it works very well for us.


-- 
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://fpgui.sourceforge.net



More information about the fpc-pascal mailing list