[Lazarus] TDateEdit.Date is not published...why?

Graeme Geldenhuys graemeg.lists at gmail.com
Fri Apr 24 10:50:13 CEST 2009


On Fri, Apr 24, 2009 at 10:15 AM, Gerard N/A <gerardusmercator at gmail.com> wrote:
>
>> scary.  Try and do multi-currency calculations with a Currency type.
>
> Just out of  curiosity, where's the problem?

Example #1
------------------
var
  cUSD: Currency;
  cGBP: Currency;
  cEuro: Currency;
  cSum: Currency;
begin
  cUSD := 1.00;
  cGBP := 1.00;
  cEuro := cUSD + cGBP;
  cSum := cUSD + cGBP;


Problem #1:
   cEuro is only valid if exchange rate is 1:1. Which pretty
   much guaranteed not to be the case in this day and age.

Problem #2:
   What currency is cSum in?  Dollars or Pounds or something else?

...there are a few more issues like rounding, allocation of lost
decimals in case of rounding errors, etc...  :-)  A simple type simply
cannot handle such complex cases correctly.


Regards,
  - Graeme -


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




More information about the Lazarus mailing list