Thanks for the tip! I was wondering about that. Here's Mark II:

program p;

uses SysUtils, DateUtils, Math;

var

t1, t2: TDateTime;

r: Single;

function calc() : Single;

var

i, j: Integer;

begin

calc := 0;

for j:=1 to 10000 do begin

for i:=1 to 100 do begin

calc := calc + (power((1+SQRT(5))/2,i)-power((1-SQRT(5))/2,i))/SQRT(5)

end;

end;

end;

begin

t1 := Now();

r := calc;

t2 := Now();

WriteLn(r,' ',MilliSecondsBetween(t2, t1));

end.

I gained about 8ms on my machine. As it stands, Pascal runs at about 140ms avg and my C version compiled with clang is at about 90ms avg per run, both optimized with -O4.

I have to say, the disparity is very disheartening. The DSP code I wish to port over relies on tight loops that cannot be vectorized due to the complex calculations within. If the results I have been seeing in my comparison tests were in the neighborhood, I'd take the plunge, but it looks like FP is not for my use case. And I really like the idea of being able to cross-compile the Windows version on my Mac! If I was making a command-line or desktop application, Pascal would be a no-brainer, but right now, I have a need for speed.

Unless somebody has any suggestions (other than raw assembly), I will probably have to move on.