Greetings, group. This is my inaugural posting, having just been approved. I 
hope my query is at a level of sophistication appropriate to this forum. If 
not, please do not hesitate to advise me and I will pose the question to a 
beginner's or intermediate forum

I have returned in recent weeks to my admittedly obsolete but still
functional copy of Delphi 2.0 Desktop.

I have been playing around with numerical analysis issues and extended
type floating point variables and results.

My main computer is a three year old Athlon 2800+ machine. I won't bore
you with the mathematics I am doing, but suffice to day I get close to full
18-digit extended precision with Delphi 2.0-compilied code on pretty
well every computer I have tested my code on (Pentium III, Pentium 4,
Centrino, newer Celeron, old AMD Duron), except this Athlon 2800+
device, where 15- or 16-digit precision is the best I can get.

The following little routine is informative. For brevity I include only
the variable declarations and the relevant procedure code, not the
entire unit:

var
  Form1: TForm1;
  d, t: double;
  ld, lt: extended;
  i: integer;

procedure TForm1.Button1Click(Sender: TObject);
begin
  d := 1.0;
    i := -1;

    repeat
        t := d + 1.0;
        d := d / 2;
        i := i + 1;
    until (t = 1.0);

    Edit1.Text := IntToStr(i);

    ld := 1.0;
    i := -1;

    repeat
        lt := ld + 1.0;
        ld := ld / 2;
        i := i + 1;
    until (lt =1.0);

    Edit2.Text := IntToStr(i);
end;

The idea is to compute the geometric series 1 + 1/2 + 1/4 + 1/8, etc.,
and report back how many iterations to machine-precision convergence.
In double floating point conditions, where numbers have a 53 bit
mantissa,  the number of iterations is 53, and and with extended type
number, with their 64 bit mantissa, the number of iterations is, yes
indeed, 64.

On my Athlon 2800+, the program returns 53 for BOTH series (extended
and double), yet the expected results of 53 and 64 on other machines I
have mentioned.

I should also note that when I compile related code in Delphi 2 as a simple 
console application, I get the correct results--53 for double, 64 for 
extended--even on the troublesome Athlon machine. That is the most curious 
aspect of all of this for me.

I am left to conclude the Delphi 2.0 compiled Windows (not console) programs 
don't interface correctly with the Athlon 2800+ processor to take full 
advantage of
extended floating point calculation, defaulting instead to type double. Why 
this doesn't happen with Delphi 2 compiled console apps mystifies me.

Any ideas about this? A C programming acquaintance suggested that the
"old" Delphi code may not be recognizing the Athlon processor FPU as an
Intel clone, but such machine level considerations are beyond me so I
took his advice to post here.

Is there a work around, a patch, a library I should have? Are there
specific compiler directives I should be using to get my code to
interface properly with the Athlon FPU? Or is it simply not possibly
with this old compiler, and I should just upgrade my Delphi (a costly
option for a hobbyist, albeit a keen one) or just do this work on a compatible 
computer?

Grateful for advice.

Best,

Les




-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to