Relooking at your timings and mine, it appears that you allocate 10x my count
of register-size count of items and require 10x the FillChar which you need to
initialize your filter array.
My timing is about 80 ms and yours looks like 900 ms for 10x more register
sized data, which look like the r
My results :
_Ptr:=GetMem(1)18 mus, 824 ns / GetMem
_Ptr:=GetMem(1) + FillChar(_Ptr^,1,0)); 81 ms / GetMem +
FillChar
var
ArInt:array of int32;
.
SetLength(ArInt, 1 shr 2); 81 ms / SetLength
All timings are variable within [time, time+8%] on rep
My point of view after looking at the code.
This code is not thread safe.
Discussion
gtest.sflag := inttostr(gtest.nflag) ; -> will call
fpc_AnsiStr_To_ShortStr
fpc_AnsiStr_To_ShortStr is programmed as :
procedure fpc_AnsiStr_To_ShortStr (out res: shortstring; const S2 :
Ansist
Lets restate the hole thing, considering unit ncon.pas and pexpr.pas units
in FPC 2.6.4
compiler.
1° It is not possible, without using some ad hoc adjustements, to have
always an EXACT CURRENCY stored in a DOUBLE or EXTENDED because Double or
Extended being expressed as Sign*2^exp*Base2(n). Just
You have troubled me seriously, so I have dug in the compiler source.
It appears that when parsing the source, Currency constants are cast to type
BestReal (EXTENDED on I386) before being converted to the 8 byte currency
written to the PPU or EXE or whatever is done. The combination of these
My point N°2 regarding potential FPU difference was only concerning instruction
line
e:=c;
=
I have absolutely no idea of how the compiler does translate Currency constant
to code, sorry.
May be it uses the FPU when translating from String representation to assembler
Lacak :
1 - XP difference between 2.6.4 and 2.7.1 on same machine
writeln('extended=', e);
extended=-9.22337203685477580811E+0014 <== HERE
calls str_real in real2str.inc that is in the course of beeing modified
in 2.7.1. If your compare the source code, you will see it has ch
Tested with FPC 2.6.4 .
LacaK are you sure you compile with the same version.
To me everything looks fine.
program test_Currency;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
SysUtils;
var
s: string;
c: currency;
e: extended;
d: double;
i64: