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

Gerard N/A gerardusmercator at gmail.com
Fri Apr 24 12:01:37 CEST 2009


On Fri, Apr 24, 2009 at 10:50 AM, Graeme Geldenhuys
<graemeg.lists at gmail.com> wrote:
> 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?
>

I don't get it. Why would you add USD and GBP and assign the result to
a variable wich is supposed to hold Euros?

> ...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.

Ok, maybe the name "currency" can be confusing. Curency is a fixed
point real type with 4 decimal places.
Anyway, handling conversions between currencies requires more than
even a simple class.
You would need to know at least what is the exchange rate for a given
conversion.

Regards,

Gerard.




More information about the Lazarus mailing list