Re: [fpc-pascal] Extended, Currency and TDateTime memory layout

2010-08-08 Thread Bart
>From D3 Help: The Currency type is a fixed-point data type suitable for monetary calculations. It is stored as a scaled 64-bit integer with the four least-significant digits implicitly representing four decimal places. Bart ___ fpc-pascal maillist -

Re: [fpc-pascal] Extended, Currency and TDateTime memory layout

2010-08-08 Thread Marc Weustink
Felipe Monteiro de Carvalho wrote: On Fri, Aug 6, 2010 at 4:52 PM, Michael Van Canneyt wrote: Strange, because tkCurrency exists ? A currency is a Int64, which is the currency amount multiplied by 1. Well, apparently Delphi 6 RTTI thinks that it is a float. Check this code: A currency

Re: [fpc-pascal] Extended, Currency and TDateTime memory layout

2010-08-07 Thread Felipe Monteiro de Carvalho
On Sat, Aug 7, 2010 at 10:44 PM, Zaher Dirkey wrote: > 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. Interresting enough, the exact same value is returned. From my research on

Re: [fpc-pascal] Extended, Currency and TDateTime memory layout

2010-08-07 Thread Felipe Monteiro de Carvalho
Hello, I managed to read the extended by putting it in a program like this: procedure TForm1.Button1Click(Sender: TObject); var Hex: array[0..9] of Byte; Num: Extended; begin Hex[0] := $00; Hex[1] := $00; Hex[2] := $00; Hex[3] := $00; Hex[4] := $00; Hex[5] := $00; Hex[6] := $00;

Re: [fpc-pascal] Extended, Currency and TDateTime memory layout

2010-08-07 Thread Felipe Monteiro de Carvalho
On Sat, Aug 7, 2010 at 10:44 PM, Zaher Dirkey wrote: > 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. Yes, but I didn't write the server I just need to interface with it's

Re: [fpc-pascal] Extended, Currency and TDateTime memory layout

2010-08-07 Thread Zaher Dirkey
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 1. > > Well, apparently Delphi 6 RTTI thinks that it is a float. Check this code: > > 471 else if ElmTypeI

Re: [fpc-pascal] Extended, Currency and TDateTime memory layout

2010-08-07 Thread Felipe Monteiro de Carvalho
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 wrote: > Strange, because tkCurrency exists ? >

Re: [fpc-pascal] Extended, Currency and TDateTime memory layout

2010-08-06 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said: > > Similarly, it seams that most often TDateTime=double. Any docs on the > > memory layout of TDateTime? > > TDateTime IS a double. > > The integer part is the number of days since 1/1/1900 No, since 12/30/1899. While the above definition was o

Re: [fpc-pascal] Extended, Currency and TDateTime memory layout

2010-08-06 Thread Michael Van Canneyt
On Fri, 6 Aug 2010, Felipe Monteiro de Carvalho wrote: Hello, I am interfacing with a server written in Delphi via network and it sends over data. The server sends some data types, and among the hardest ones to read are Currency and TDateTime. The server is undocumented and does some strange

[fpc-pascal] Extended, Currency and TDateTime memory layout

2010-08-06 Thread Felipe Monteiro de Carvalho
Hello, I am interfacing with a server written in Delphi via network and it sends over data. The server sends some data types, and among the hardest ones to read are Currency and TDateTime. The server is undocumented and does some strange transformations of the data using RTTI to pass properties.