[fpc-pascal] Extended, Currency and TDateTime memory layout
Felipe Monteiro de Carvalho
felipemonteiro.carvalho at gmail.com
Sat Aug 7 20:56:41 CEST 2010
For single and double there is a nice converter which shows the binary layout:
http://babbage.cs.qc.edu/IEEE-754/Decimal.html
Unfortunately there seams to be much less resources about extended...
On Fri, Aug 6, 2010 at 4:52 PM, Michael Van Canneyt
<michael at freepascal.org> wrote:
> Strange, because tkCurrency exists ?
>
> 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;
But this code is in another part of the program.
For that particular part it simply converts any float type to
extended, which was a pretty nasty thing to do.
--
Felipe Monteiro de Carvalho
More information about the fpc-pascal
mailing list