On Sat, Aug 7, 2010 at 9:56 PM, Felipe Monteiro de Carvalho <
felipemonteiro.carva...@gmail.com> wrote:

> > A currency is a Int64, which is the currency amount multiplied by 10000.
>
> Well, apparently Delphi 6 RTTI thinks that it is a float. Check this code:
>
> 471               else if ElmTypeInfo.Kind in [tkFloat] then begin
> 472                 case TypeData.FloatType of
> 473                   ftSingle: Stream.Write(DynArray^, ArrayLength *
> SizeOf(Single));
> 474                   ftDouble: Stream.Write(DynArray^, ArrayLength *
> SizeOf(Double));
> 475                   ftComp: Stream.Write(DynArray^, ArrayLength *
> SizeOf(Comp));
> 476                   ftCurr: Stream.Write(DynArray^, ArrayLength *
> SizeOf(Currency));
> 477                   ftExtended: Stream.Write(DynArray^, ArrayLength *
> SizeOF(Extended));
> 478                 end;
>

A Currency is a Int64 not float, if you assign currency to float variable
(double/extended) and return back to currency variable, you will not get the
same value.
Typecast the currency as Int64, assign it to int64 variable and vise versa
you will not lose any thing.

Best regards
-- 
Zaher Dirkey
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to