Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Speeding up Delphi floating point variable operations

Avatar of drtester
drtester asked on
8 Comments1 Solution569 ViewsLast Modified:
I'm a Delphi beginner, and messing with a program that uses floating point variables.  However, when timing part of my code, I'm seeing a simple instruction like:

 x := x + 1

taking literally thousands of CPU cycles to execute.  Looking at the compiled code, I see this line turned into:

 fld tbyte ptr [ebp-$20]
 fadd dword ptr [$0045fa98]  //I'm guessing this points to a "1" in FP,
                             //as the data is 3f 80 00 00
 fstp tbyte ptr [ebp-$20]

Why must I 'wait' for this to execute?  Shoudn't floating point on modern processors be quick?  Is there some config option I need to turn on in Delphi 7 to fix this?
Avatar of aflarin
This problem has been solved!
Unlock 1 Answer and 8 Comments.
See Answers