shawn857
asked on
Faster than FloatToStr command...?
Hello all, does anyone know of a faster/more efficient alternative to the Delphi FloatToStr function?
Thanks
Shawn
P.S: I'm using Delphi 7.
Thanks
Shawn
P.S: I'm using Delphi 7.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No, there is not FloatToStr (yet) on fastcode page.
I don't suggest to show more than 8 decimal places - and this should be fine too:
... or
... with default formatting.
I don't suggest to show more than 8 decimal places - and this should be fine too:
Label1.Caption := Format('%.8f', [12228763521.65255362]);
... or
Label1.Caption := Format('%f', [12228763521.65255362]);
... with default formatting.
ASKER
Thanks Sinisa, I'll try that.
Looking at the Fastcode page, I noticed there were a few other routines that would be useful for me. I'm a little confused about the usage though. It seems for each fucntion, there are many different ways to call it:
function XXXFastcodeP4N;
function XXXFastcodeP4P;
function XXXFastcodePMD;
function XXXFastcodePMB;
function XXXFastcodeAthlonXP;
function XXXFastcodeAMD64;
I don't really want a "hardware-specific" version...Is any one of these okay, or do you know if there is just a regular "generic" way to call the function?
Thanks!
Shawn
Looking at the Fastcode page, I noticed there were a few other routines that would be useful for me. I'm a little confused about the usage though. It seems for each fucntion, there are many different ways to call it:
function XXXFastcodeP4N;
function XXXFastcodeP4P;
function XXXFastcodePMD;
function XXXFastcodePMB;
function XXXFastcodeAthlonXP;
function XXXFastcodeAMD64;
I don't really want a "hardware-specific" version...Is any one of these okay, or do you know if there is just a regular "generic" way to call the function?
Thanks!
Shawn
Using assembler variant of function for Intel processors is a good way too.
ASKER
Thanks Sinisa. How do I know which one is the assembler variant function for intel processors?
Thanks
Shawn
Thanks
Shawn
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
look at the complete picture ... for improvements
does the input have to be a float ?
this may be an odd question ... but what if you got an integer for the integer part
and an integer for the fractional part
inttostr is probably somewhat faster than floattostr
does the input have to be a float ?
this may be an odd question ... but what if you got an integer for the integer part
and an integer for the fractional part
inttostr is probably somewhat faster than floattostr
ASKER
Hi Geert, well, that won't help for the odd times when the float number happens to be in Scientific Notation.
Thanks
Shawn
Thanks
Shawn
Yes, we can just abandon it... sorry for that. A pretty nit-picky question from me to begin with actually...
Regards
Shawn
Regards
Shawn
ASKER
I looked briefly at the fastcode page. Do you know if there's a "FloatToStr" function there?
Thanks!
Shawn